mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 13:11:39 +01: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. llvm-svn: 123133
This commit is contained in:
parent
b6a67a9068
commit
4efcd276de
@ -1560,10 +1560,14 @@ const SCEV *ScalarEvolution::getAddExpr(SmallVectorImpl<const SCEV *> &Ops,
|
|||||||
AddRecOps[0] = getAddExpr(LIOps);
|
AddRecOps[0] = getAddExpr(LIOps);
|
||||||
|
|
||||||
// Build the new addrec. Propagate the NUW and NSW flags if both the
|
// 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.
|
// outer add and the inner addrec are guaranteed to have no overflow or if
|
||||||
const SCEV *NewRec = getAddRecExpr(AddRecOps, AddRecLoop,
|
// there is no outer part.
|
||||||
HasNUW && AddRec->hasNoUnsignedWrap(),
|
if (Ops.size() != 1) {
|
||||||
HasNSW && AddRec->hasNoSignedWrap());
|
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 all of the other operands were loop invariant, we are done.
|
||||||
if (Ops.size() == 1) return NewRec;
|
if (Ops.size() == 1) return NewRec;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user