From: Chris Lattner Date: Tue, 11 Jan 2011 06:44:41 +0000 (+0000) Subject: the GEP faq says that only inbounds geps are guaranteed to not overflow. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=965187081538623b5ed76beafb6888c81dcc80f2;p=oota-llvm.git the GEP faq says that only inbounds geps are guaranteed to not overflow. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123218 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index 922751fe3d1..8deade345fe 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -2722,11 +2722,12 @@ const SCEV *ScalarEvolution::createNodeForPHI(PHINode *PN) { HasNUW = true; if (OBO->hasNoSignedWrap()) HasNSW = true; - } else if (isa(BEValueV)) { + } else if (const GEPOperator *GEP = + dyn_cast(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);