llvm.org GIT mirror llvm / 587c78e
[Constants] don't die processing non-ConstantInt GEP indices in isGEPWithNoNotionalOverIndexing() (PR31262) This should fix: https://llvm.org/bugs/show_bug.cgi?id=31262 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289401 91177308-0d34-0410-b5e6-96231b3b80d8 Sanjay Patel 2 years ago
2 changed file(s) with 19 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
10701070 gep_type_iterator GEPI = gep_type_begin(this), E = gep_type_end(this);
10711071 User::const_op_iterator OI = std::next(this->op_begin());
10721072
1073 // The remaining indices must be compile-time known integers within the
1074 // bounds of the corresponding notional static array types.
1073 // The remaining indices may be compile-time known integers within the bounds
1074 // of the corresponding notional static array types.
10751075 for (; GEPI != E; ++GEPI, ++OI) {
1076 ConstantInt *CI = dyn_cast(*OI);
1077 if (GEPI.isBoundedSequential() &&
1078 (CI->getValue().getActiveBits() > 64 ||
1079 CI->getZExtValue() >= GEPI.getSequentialNumElements()))
1076 if (isa(*OI))
1077 continue;
1078 auto *CI = dyn_cast(*OI);
1079 if (!CI || (GEPI.isBoundedSequential() &&
1080 (CI->getValue().getActiveBits() > 64 ||
1081 CI->getZExtValue() >= GEPI.getSequentialNumElements())))
10801082 return false;
10811083 }
10821084
6262 %equal = icmp eq i32* %a, %b
6363 ret i1 %equal
6464 ; CHECK-NEXT: ret i1 false
65 }
66
67 @a = common global [1 x i32] zeroinitializer, align 4
68
69 define i1 @PR31262() {
70 ; CHECK-LABEL: @PR31262(
71 ; CHECK-NEXT: ret i1 icmp uge (i32* getelementptr ([1 x i32], [1 x i32]* @a, i64 0, i64 undef), i32* getelementptr inbounds ([1 x i32], [1 x i32]* @a, i32 0, i32 0))
72 ;
73 %idx = getelementptr inbounds [1 x i32], [1 x i32]* @a, i64 0, i64 undef
74 %cmp = icmp uge i32* %idx, getelementptr inbounds ([1 x i32], [1 x i32]* @a, i32 0, i32 0)
75 ret i1 %cmp
6576 }
6677
6778 define i1 @gep5() {