[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:26:18 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]]
----------------
nikic wrote:

Currently LLVM doesn't make assumptions about how different allocations types are positioned relative to each other. We'd have to add LangRef wording for this, to require that allocas and globals allocations cannot be adjacent.

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


More information about the llvm-commits mailing list