https://bugs.llvm.org/show_bug.cgi?id=44423
Bug ID: 44423
Summary: LLVM 10 regression in gep inbounds of zero-offset gep
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
define i32* @test([0 x i32]* %base, i64 %idx) {
%base2 = bitcast [0 x i32]* %base to i32*
;%base2 = getelementptr [0 x i32], [0 x i32]* %base, i64 0, i64 0
%ptr = getelementptr inbounds i32, i32* %base2, i64 %idx
ret i32* %ptr
}
opt -instcombine now gives:
define i32* @test([0 x i32]* %base, i64 %idx) {
%ptr = getelementptr [0 x i32], [0 x i32]* %base, i64 0, i64 %idx
ret i32* %ptr
}
while previously:
define i32* @test([0 x i32]* %base, i64 %idx) {
%ptr = getelementptr inbounds [0 x i32], [0 x i32]* %base, i64 0, i64 %idx
ret i32* %ptr
}
This is because bitcasts are now converted to gep rather than gep inbounds, and
we drop the inbounds when combining both geps.
I believe that in this case the inbounds should be preserved, as the base gep
is zero-offset, so it has no impact on the overall inbounds-ness of the
operation.
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs