teach SCEV analysis of PHI nodes that PHI recurences formed
with GEP instructions are always NUW, because PHIs cannot wrap
the end of the address space.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123105 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index fa828ac..b675e28 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -2719,6 +2719,11 @@
                   HasNUW = true;
                 if (OBO->hasNoSignedWrap())
                   HasNSW = true;
+              } else if (isa<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;
               }
 
               const SCEV *StartVal = getSCEV(StartValueV);