diff options
| author | Haicheng Wu <haicheng@codeaurora.org> | 2017-10-28 02:27:14 +0000 |
|---|---|---|
| committer | Haicheng Wu <haicheng@codeaurora.org> | 2017-10-28 02:27:14 +0000 |
| commit | eb92e569dedf2b21fa742b5976d34da06b6022c7 (patch) | |
| tree | ff44ca56cd3c42b9e503793ad29c60e2cc0372af /llvm/lib/IR | |
| parent | fd0a35a6495fce7f4e5254665680b47f7cd51d64 (diff) | |
| download | bcm5719-llvm-eb92e569dedf2b21fa742b5976d34da06b6022c7.tar.gz bcm5719-llvm-eb92e569dedf2b21fa742b5976d34da06b6022c7.zip | |
[ConstantFold] Fix a crash when folding a GEP that has vector index
LLVM crashes when factoring out an out-of-bound index into preceding dimension
and the preceding dimension uses vector index. Simply bail out now when this
case happens.
Differential Revision: https://reviews.llvm.org/D38677
llvm-svn: 316824
Diffstat (limited to 'llvm/lib/IR')
| -rw-r--r-- | llvm/lib/IR/ConstantFold.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp index 044cc1ff449..c826f757e6d 100644 --- a/llvm/lib/IR/ConstantFold.cpp +++ b/llvm/lib/IR/ConstantFold.cpp @@ -2219,6 +2219,9 @@ Constant *llvm::ConstantFoldGetElementPtr(Type *PointeeTy, Constant *C, Unknown = true; continue; } + if (!isa<ConstantInt>(Idxs[i - 1])) + // FIXME: add the support of cosntant vector index. + continue; if (InRangeIndex && i == *InRangeIndex + 1) { // If an index is marked inrange, we cannot apply this canonicalization to // the following index, as that will cause the inrange index to point to |

