Teach instcombine to respect and preserve inbounds. Add inbounds
to a few tests where it is required for the expected transformation.
llvm-svn: 77290
diff --git a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
index eb2236b..e098ea2 100644
--- a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
+++ b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp
@@ -349,7 +349,9 @@
return GEP;
}
- // Insert a pretty getelementptr.
+ // Insert a pretty getelementptr. Note that this GEP is not marked inbounds,
+ // because ScalarEvolution may have changed the address arithmetic to
+ // compute a value which is beyond the end of the allocated object.
Value *GEP = Builder.CreateGEP(V,
GepIndices.begin(),
GepIndices.end(),