-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[mlir][spirv] Verify matching of entry block arguments and function signature #133167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-mlir-spirv @llvm/pr-subscribers-mlir Author: AdityaK (hiraditya) ChangesFixes: #132894 Full diff: https://github.com/llvm/llvm-project/pull/133167.diff 2 Files Affected:
diff --git a/mlir/lib/Interfaces/CallInterfaces.cpp b/mlir/lib/Interfaces/CallInterfaces.cpp
index e8ed4b339a0cb..815b906d7d0f2 100644
--- a/mlir/lib/Interfaces/CallInterfaces.cpp
+++ b/mlir/lib/Interfaces/CallInterfaces.cpp
@@ -116,9 +116,10 @@ void call_interface_impl::printFunctionSignature(
if (!isExternal) {
ArrayRef<NamedAttribute> attrs;
- if (argAttrs)
+ if (argAttrs) {
attrs = llvm::cast<DictionaryAttr>(argAttrs[i]).getValue();
- p.printRegionArgument(body->getArgument(i), attrs);
+ p.printRegionArgument(body->getArgument(i), attrs);
+ }
} else {
p.printType(argTypes[i]);
if (argAttrs)
diff --git a/mlir/test/mlir-opt/print-region.mlir b/mlir/test/mlir-opt/print-region.mlir
new file mode 100644
index 0000000000000..678457defff57
--- /dev/null
+++ b/mlir/test/mlir-opt/print-region.mlir
@@ -0,0 +1,17 @@
+// Bug: https://github.com/llvm/llvm-project/issues/132894
+
+// RUN: mlir-opt %s | FileCheck
+
+// CHECK: module {
+// CHECK: spirv.func @f(f32) "None" {
+// CHECK: %c0 = arith.constant 0 : index
+// CHECK: spirv.Return
+// CHECK: }
+// CHECK: }
+
+module {
+ spirv.func @f(f32) "None" {
+ %c0 = arith.constant 0 : index
+ spirv.Return
+ }
+}
|
cc3d634
to
30187f5
Compare
The FunctionOpInterface implement the verifyBody and check the arguments number. llvm-project/mlir/include/mlir/Interfaces/FunctionInterfaces.td Lines 86 to 99 in dad86f5
The
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, @kuhar any more comments here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixes: #132894