[Mlir-commits] [mlir] [MLIR][LLVM] Block address support (PR #134335)
Tobias Gysi
llvmlistbot at llvm.org
Sat Apr 5 05:33:30 PDT 2025
================
@@ -692,3 +692,19 @@ llvm.func @caller(%x : i32) -> i32 {
%z = llvm.call @unreachable_func(%x) : (i32) -> (i32)
llvm.return %z : i32
}
+
+// -----
+// Check that @func is not inlined because of llvm.blocktag
+
+func.func @func(%arg0 : i32) -> i32 {
+ llvm.blocktag <id = 1>
+ llvm.return %arg0 : i32
+}
+// CHECK-LABEL: @llvm_ret
+// CHECK-NOT: llvm.blocktag
+// CHECK: %[[R:.*]] = call
+// CHECK: return %[[R]]
+func.func @llvm_ret(%arg0 : i32) -> i32 {
+ %res = call @func(%arg0) : (i32) -> (i32)
+ return %res : i32
+}
----------------
gysit wrote:
```suggestion
// -----
// Check that @func is not inlined because of llvm.blocktag.
func.func @func(%arg0 : i32) -> i32 {
llvm.blocktag <id = 1>
llvm.return %arg0 : i32
}
// CHECK-LABEL: @llvm_ret
func.func @llvm_ret(%arg0 : i32) -> i32 {
// CHECK-NOT: llvm.blocktag
// CHECK: = call @func
%res = call @func(%arg0) : (i32) -> (i32)
return %res : i32
}
```
nit: we typically prefer the check lines close to the actual source.
https://github.com/llvm/llvm-project/pull/134335
More information about the Mlir-commits
mailing list