-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[mlir][EmitC] Fix call ops with zero arguments in func to emitc conversion #94936
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@llvm/pr-subscribers-mlir-emitc @llvm/pr-subscribers-mlir Author: Simon Camphausen (simon-camp) ChangesFull diff: https://github.com/llvm/llvm-project/pull/94936.diff 2 Files Affected:
diff --git a/mlir/lib/Conversion/FuncToEmitC/FuncToEmitC.cpp b/mlir/lib/Conversion/FuncToEmitC/FuncToEmitC.cpp
index 6a8ecb7b00473..f0bb2093af277 100644
--- a/mlir/lib/Conversion/FuncToEmitC/FuncToEmitC.cpp
+++ b/mlir/lib/Conversion/FuncToEmitC/FuncToEmitC.cpp
@@ -38,7 +38,7 @@ class CallOpConversion final : public OpConversionPattern<func::CallOp> {
rewriter.replaceOpWithNewOp<emitc::CallOp>(
callOp,
- callOp.getNumResults() ? callOp.getResult(0).getType() : nullptr,
+ callOp.getNumResults() ? callOp.getResult(0).getType() : TypeRange{},
adaptor.getOperands(), callOp->getAttrs());
return success();
diff --git a/mlir/test/Conversion/FuncToEmitC/func-to-emitc.mlir b/mlir/test/Conversion/FuncToEmitC/func-to-emitc.mlir
index 5c96cf1ce0d34..5730f7a4814fa 100644
--- a/mlir/test/Conversion/FuncToEmitC/func-to-emitc.mlir
+++ b/mlir/test/Conversion/FuncToEmitC/func-to-emitc.mlir
@@ -58,3 +58,19 @@ func.func @call(%arg0: i32) -> i32 {
// CHECK-LABEL: emitc.func private @return_i32(i32) -> i32 attributes {specifiers = ["extern"]}
func.func private @return_i32(%arg0: i32) -> i32
+
+// -----
+
+// CHECK-LABEL: emitc.func private @return_void() attributes {specifiers = ["static"]}
+// CHECK-NEXT: emitc.return
+func.func private @return_void() {
+ return
+}
+
+// CHECK-LABEL: emitc.func @call()
+// CHECK-NEXT: emitc.call @return_void() : () -> ()
+// CHECK-NEXT: emitc.return
+func.func @call() {
+ call @return_void() : () -> ()
+ return
+}
|
0505444
to
14dacb0
Compare
mgehre-amd
reviewed
Jun 10, 2024
mgehre-amd
approved these changes
Jun 10, 2024
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 the fix!
Closed
mgehre-amd
pushed a commit
to Xilinx/llvm-project
that referenced
this pull request
Jul 10, 2024
mgehre-amd
added a commit
to Xilinx/llvm-project
that referenced
this pull request
Jul 10, 2024
[mlir][EmitC] Fix call ops with zero arguments in func to emitc conversion (llvm#94936)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.