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

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 11 16:28:16 PST 2024


================
@@ -282,8 +285,9 @@ define i1 @zst_alloca_end() {
 define i1 @zst_global_start() {
 ; CHECK-LABEL: @zst_global_start(
 ; CHECK-NEXT:    [[A:%.*]] = alloca i64, align 8
+; CHECK-NEXT:    [[CMP:%.*]] = icmp eq ptr [[A]], @gz
 ; CHECK-NEXT:    call void @escape(ptr [[A]], ptr @gz)
-; CHECK-NEXT:    ret i1 false
+; CHECK-NEXT:    ret i1 [[CMP]]
----------------
dtcxzyw wrote:

This case (alloca != global) should be folded.


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


More information about the llvm-commits mailing list