[mlir][vector] Skip vector mask elimination for funcs without body#173330
Conversation
|
@llvm/pr-subscribers-mlir @llvm/pr-subscribers-mlir-vector Author: Prathamesh Tagore (meshtag) ChangesAvoids a crash in test-eliminate-vector-masks pass by bailing out when the target function has no body. Fixes #132160. Full diff: https://github.com/llvm/llvm-project/pull/173330.diff 2 Files Affected:
diff --git a/mlir/lib/Dialect/Vector/Transforms/VectorMaskElimination.cpp b/mlir/lib/Dialect/Vector/Transforms/VectorMaskElimination.cpp
index 8a181a429e41c..6f75ce7a04511 100644
--- a/mlir/lib/Dialect/Vector/Transforms/VectorMaskElimination.cpp
+++ b/mlir/lib/Dialect/Vector/Transforms/VectorMaskElimination.cpp
@@ -99,6 +99,10 @@ void eliminateVectorMasks(IRRewriter &rewriter, FunctionOpInterface function,
if (!vscaleRange)
return;
+ // Early exit for functions without a body.
+ if (function.isExternal())
+ return;
+
OpBuilder::InsertionGuard g(rewriter);
// Build worklist so we can safely insert new ops in
diff --git a/mlir/test/Dialect/Vector/eliminate-masks.mlir b/mlir/test/Dialect/Vector/eliminate-masks.mlir
index 0b78687fb9832..71b4a1f959b39 100644
--- a/mlir/test/Dialect/Vector/eliminate-masks.mlir
+++ b/mlir/test/Dialect/Vector/eliminate-masks.mlir
@@ -163,3 +163,9 @@ func.func @negative_value_bounds_scalable_dim_not_all_true(%tensor: tensor<2x100
"test.some_use"(%mask) : (vector<3x[4]xi1>) -> ()
return
}
+
+// -----
+
+// Test to ensure that functions without a body are skipped.
+// CHECK-LABEL: func.func private @decl_only(tensor<*xi32>)
+func.func private @decl_only(tensor<*xi32>)
|
|
I'll need help merging this. Thanks! |
08e67ab to
6a3f338
Compare
banach-space
left a comment
There was a problem hiding this comment.
Hey @meshtag , thanks for fixing this!
LGTM % some ultra-nits
Avoids a crash in test-eliminate-vector-masks pass by bailing out when the target function has no body.
6a3f338 to
153621e
Compare
|
Addressed feedback. Please merge it if you think it is ready. Thanks @banach-space! |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/129/builds/35607 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/52/builds/13924 Here is the relevant piece of the build log for the reference |
Avoids a crash in test-eliminate-vector-masks pass by bailing out when the target function has no body.
Fixes #132160.