[PATCH] D20663: [ConstantFold] Fix incorrect index rewrites for GEPs

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Wed May 25 23:18:36 PDT 2016


majnemer accepted this revision.
majnemer added a comment.
This revision is now accepted and ready to land.

LGTM


================
Comment at: lib/IR/ConstantFold.cpp:2196-2197
@@ -2195,4 +2195,4 @@
     if (ConstantInt *CI = dyn_cast<ConstantInt>(Idxs[i])) {
-      if (isa<ArrayType>(Ty) || isa<VectorType>(Ty))
+      if (isa<ArrayType>(Ty))
         if (CI->getSExtValue() > 0 &&
             !isIndexInRangeOfSequentialType(cast<SequentialType>(Ty), CI)) {
----------------
These conditions can now be merged.

================
Comment at: lib/IR/ConstantFold.cpp:2198
@@ -2197,3 +2197,3 @@
         if (CI->getSExtValue() > 0 &&
             !isIndexInRangeOfSequentialType(cast<SequentialType>(Ty), CI)) {
           if (isa<SequentialType>(Prev)) {
----------------
`cast<SequentialType>` can now be `cast<ArrayType>`


http://reviews.llvm.org/D20663





More information about the llvm-commits mailing list