[llvm] [Attributor] Do not delete side-effect-free callbr (PR #205052)

Antonio Frighetto via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 22 02:06:22 PDT 2026


================
@@ -0,0 +1,23 @@
+; RUN: opt -passes=attributor -verify-each -S < %s | FileCheck %s
+
+; Regression test for #192012: a side-effect-free callbr is still a terminator
+; and must not be queued for generic deletion after manifestation.
+define i32 @callbr_is_not_deleted_as_dead_callbase() {
+; CHECK-LABEL: define {{[^@]+}}@callbr_is_not_deleted_as_dead_callbase
+; CHECK:       entry:
+; CHECK-NEXT:    [[MEM:%.*]] = alloca i32, align 4
+; CHECK-NEXT:    callbr void asm "", "=*m,!i"(ptr elementtype(i32) [[MEM]]) #[[ATTR:[0-9]+]]
+; CHECK-NEXT:            to label %common.ret [label %common.ret]
+; CHECK:       common.ret:
+; CHECK-NEXT:    ret i32 0
+;
+entry:
+  %mem = alloca i32, align 4
+  callbr void asm "", "=*m,!i"(ptr elementtype(i32) %mem) #0
----------------
antoniofrighetto wrote:

This says that the asm writes through `%mem` as output but contradicts the memory effects of the call-site (`memory(none)`)? Is the test, crafted this way, needed to trigger the path?

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


More information about the llvm-commits mailing list