[llvm] [SeparateConstOffsetFromGEP] Fix incorrect inbounds flag in case of non-negative index but negative offset (PR #190192)
Eli Friedman via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 2 10:55:51 PDT 2026
================
@@ -262,8 +262,8 @@ define void @addrspace1(ptr addrspace(1) %in.ptr, i64 %in.idx1) {
; CHECK-SAME: ptr addrspace(1) [[IN_PTR:%.*]], i64 [[IN_IDX1:%.*]]) #[[ATTR0]] {
; CHECK-NEXT: entry:
; CHECK-NEXT: [[IN_IDX1_NNEG:%.*]] = and i64 [[IN_IDX1]], 9223372036854775807
-; CHECK-NEXT: [[TMP0:%.*]] = getelementptr inbounds i128, ptr addrspace(1) [[IN_PTR]], i64 [[IN_IDX1_NNEG]]
-; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds i8, ptr addrspace(1) [[TMP0]], i64 1024
+; CHECK-NEXT: [[TMP0:%.*]] = getelementptr i128, ptr addrspace(1) [[IN_PTR]], i64 [[IN_IDX1_NNEG]]
+; CHECK-NEXT: [[IDX11:%.*]] = getelementptr i8, ptr addrspace(1) [[TMP0]], i64 1024
----------------
efriedma-quic wrote:
We shouldn't need to strip inbounds here: the indexes are nonnegative in both the input and output.
https://github.com/llvm/llvm-project/pull/190192
More information about the llvm-commits
mailing list