mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
Step #3 to improving trip count analysis: If we fold
a + {b,+,stride} into {a+b,+,stride} (because a is LIV), then the resultant AddRec is NUW/NSW if the client says it is. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123133 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
992efb0378
commit
ad19c8c63c
@ -1560,10 +1560,14 @@ const SCEV *ScalarEvolution::getAddExpr(SmallVectorImpl<const SCEV *> &Ops,
|
||||
AddRecOps[0] = getAddExpr(LIOps);
|
||||
|
||||
// Build the new addrec. Propagate the NUW and NSW flags if both the
|
||||
// outer add and the inner addrec are guaranteed to have no overflow.
|
||||
const SCEV *NewRec = getAddRecExpr(AddRecOps, AddRecLoop,
|
||||
HasNUW && AddRec->hasNoUnsignedWrap(),
|
||||
HasNSW && AddRec->hasNoSignedWrap());
|
||||
// outer add and the inner addrec are guaranteed to have no overflow or if
|
||||
// there is no outer part.
|
||||
if (Ops.size() != 1) {
|
||||
HasNUW &= AddRec->hasNoUnsignedWrap();
|
||||
HasNSW &= AddRec->hasNoSignedWrap();
|
||||
}
|
||||
|
||||
const SCEV *NewRec = getAddRecExpr(AddRecOps, AddRecLoop, HasNUW, HasNSW);
|
||||
|
||||
// If all of the other operands were loop invariant, we are done.
|
||||
if (Ops.size() == 1) return NewRec;
|
||||
|
Loading…
Reference in New Issue
Block a user