[PATCH] D38677: [ConstantFold] Fix a crash when folding a GEP that has vector index

Haicheng Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 8 16:34:03 PDT 2017


haicheng added inline comments.


================
Comment at: lib/IR/ConstantFold.cpp:2213
     }
+    if (!isa<ConstantInt>(Idxs[i - 1]))
+      continue;
----------------
majnemer wrote:
> Shouldn't this be `!isa<Constant>` ?
Using `!isa<Constant>` still crashes the test case.  In the test case, when `Idxs[i-1]` is `<i64 0, i64 1>` which is a `Constant` but not a `ConstantInt`, code below will cast its type to `IntegerType` and then llvm crashes.


Repository:
  rL LLVM

https://reviews.llvm.org/D38677





More information about the llvm-commits mailing list