the GEP faq says that only inbounds geps are guaranteed to not overflow.

llvm-svn: 123218
This commit is contained in:
Chris Lattner 2011-01-11 06:44:41 +00:00
parent a00bccc0c5
commit 23109cb319
1 changed files with 3 additions and 2 deletions

View File

@ -2722,11 +2722,12 @@ const SCEV *ScalarEvolution::createNodeForPHI(PHINode *PN) {
HasNUW = true;
if (OBO->hasNoSignedWrap())
HasNSW = true;
} else if (isa<GEPOperator>(BEValueV)) {
} else if (const GEPOperator *GEP =
dyn_cast<GEPOperator>(BEValueV)) {
// If the increment is a GEP, then we know it won't perform an
// unsigned overflow, because the address space cannot be
// wrapped around.
HasNUW = true;
HasNUW |= GEP->isInBounds();
}
const SCEV *StartVal = getSCEV(StartValueV);