[llvm] [LTO] Fix assertion failure in BlockAddress::get during inlining (PR #176044)

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 15 07:03:26 PST 2026


================
@@ -0,0 +1,29 @@
+; RUN: opt -S -o - < %s -passes='always-inline' | FileCheck %s
+
+; -------------------------------------------------------------------------
+; Regression Test for Issue #175516
+; Verify that inlining an asm goto with a BlockAddress operand does not
+; crash. The BlockAddress should be updated to refer to the new function.
+; -------------------------------------------------------------------------
+
+define void @asm_goto_repro(i32 %b) alwaysinline {
+entry:
+  ; The crash happened here during cloning.
+  ; "r,!i" constraints: input register "r" and label "!i".
+  callbr void asm sideeffect "", "r,!i"(ptr blockaddress(@asm_goto_repro, %label_c))
+          to label %fallthrough [label %label_c]
+
+fallthrough:
+  br label %label_c
+
+label_c:
+  ret void
+}
+
+define void @test_pr175516() {
+; CHECK-LABEL: @test_pr175516
+; CHECK: callbr void asm sideeffect "", "r,!i"(ptr blockaddress(@test_pr175516, %asm_goto_repro.exit))
+entry:
+  call void @asm_goto_repro(i32 1)
+  ret void
+}
----------------
boomanaiden154 wrote:

Nit: no newline?

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


More information about the llvm-commits mailing list