llvm.org GIT mirror llvm / 2956373
[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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316824 91177308-0d34-0410-b5e6-96231b3b80d8 Haicheng Wu 2 years ago
2 changed file(s) with 12 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
22182218 Unknown = true;
22192219 continue;
22202220 }
2221 if (!isa(Idxs[i - 1]))
2222 // FIXME: add the support of cosntant vector index.
2223 continue;
22212224 if (InRangeIndex && i == *InRangeIndex + 1) {
22222225 // If an index is marked inrange, we cannot apply this canonicalization to
22232226 // the following index, as that will cause the inrange index to point to
1212 %el = getelementptr inbounds i64, i64* undef, <8 x i64> undef
1313 ret <8 x i64*> %el
1414 }
15
16 @block = global [64 x [8192 x i8]] zeroinitializer, align 1
17
18 ; CHECK-LABEL:vectorindex
19 ; CHECK-NEXT: ret <2 x i8*> getelementptr inbounds ([64 x [8192 x i8]], [64 x [8192 x i8]]* @block, <2 x i64> zeroinitializer, <2 x i64> , <2 x i64> )
20 define <2 x i8*> @vectorindex() {
21 %1 = getelementptr inbounds [64 x [8192 x i8]], [64 x [8192 x i8]]* @block, i64 0, <2 x i64> , i64 8192
22 ret <2 x i8*> %1
23 }