[llvm] [InstSimplify] Correctly handle comparison with zero-size allocs (PR #115728)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 12 06:24:53 PST 2024


================
@@ -249,8 +250,10 @@ define i1 @zst_alloca_middle() {
 ; CHECK-LABEL: @zst_alloca_middle(
 ; CHECK-NEXT:    [[A:%.*]] = alloca i64, align 8
 ; CHECK-NEXT:    [[A2:%.*]] = alloca {}, align 8
+; CHECK-NEXT:    [[GEP:%.*]] = getelementptr i8, ptr [[A]], i64 4
+; CHECK-NEXT:    [[CMP:%.*]] = icmp eq ptr [[GEP]], [[A2]]
 ; CHECK-NEXT:    call void @escape(ptr [[A]], ptr [[A2]])
-; CHECK-NEXT:    ret i1 false
+; CHECK-NEXT:    ret i1 [[CMP]]
----------------
nikic wrote:

Here's the fix: https://github.com/llvm/llvm-project/pull/115874

https://github.com/llvm/llvm-project/pull/115728


More information about the llvm-commits mailing list