[Mlir-commits] [mlir] [MLIR][LLVM] Block address support (PR #134335)
Tobias Gysi
llvmlistbot at llvm.org
Sat Apr 5 05:33:30 PDT 2025
================
@@ -0,0 +1,36 @@
+// RUN: mlir-translate -mlir-to-llvmir %s -split-input-file | FileCheck %s
+
+llvm.mlir.global private @g() {addr_space = 0 : i32, dso_local} : !llvm.ptr {
+ %0 = llvm.blockaddress <function = @fn, tag = <id = 0>> : !llvm.ptr
+ llvm.return %0 : !llvm.ptr
+}
+
+llvm.func @fn() {
+ llvm.br ^bb1
+^bb1:
+ llvm.blocktag <id = 0>
+ llvm.return
+}
+
+// CHECK: @g = private global ptr blockaddress(@fn, %1)
+// CHECK: define void @fn() {
+// CHECK: br label %1
+// CHECK: 1:
----------------
gysit wrote:
```suggestion
// CHECK: br label %[[DEST:.*]]
// CHECK: [[DEST]]:
```
nit: not sure how stable these labels are but at least in mlir we prefer matching a variable
https://github.com/llvm/llvm-project/pull/134335
More information about the Mlir-commits
mailing list