diff options
author | Chris Lattner <sabre@nondot.org> | 2011-01-11 06:44:41 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-01-11 06:44:41 +0000 |
commit | 965187081538623b5ed76beafb6888c81dcc80f2 (patch) | |
tree | 062be6cc11a3e4d780626627aa0a4825c7f3ff2c /lib/Analysis | |
parent | f7624bc6dd57d5b4deea7c336c3e3aec67f38c9b (diff) | |
download | external_llvm-965187081538623b5ed76beafb6888c81dcc80f2.zip external_llvm-965187081538623b5ed76beafb6888c81dcc80f2.tar.gz external_llvm-965187081538623b5ed76beafb6888c81dcc80f2.tar.bz2 |
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
Diffstat (limited to 'lib/Analysis')
-rw-r--r-- | lib/Analysis/ScalarEvolution.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index 922751f..8deade3 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<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); |