[llvm-commits] [llvm] r123218 - /llvm/trunk/lib/Analysis/ScalarEvolution.cpp

Chris Lattner sabre at nondot.org
Mon Jan 10 22:44:41 PST 2011


Author: lattner
Date: Tue Jan 11 00:44:41 2011
New Revision: 123218

URL: http://llvm.org/viewvc/llvm-project?rev=123218&view=rev
Log:
the GEP faq says that only inbounds geps are guaranteed to not overflow.

Modified:
    llvm/trunk/lib/Analysis/ScalarEvolution.cpp

Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=123218&r1=123217&r2=123218&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Tue Jan 11 00:44:41 2011
@@ -2722,11 +2722,12 @@
                   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);





More information about the llvm-commits mailing list