[Mlir-commits] [mlir] 3d7383d - [mlir][affine] Prevent vectorizer test from crash without any map
Kai Sasaki
llvmlistbot at llvm.org
Wed Mar 22 18:17:44 PDT 2023
Author: Kai Sasaki
Date: 2023-03-23T10:08:53+09:00
New Revision: 3d7383d7f44a4b9760f6566e62950968e90e0a1c
URL: https://github.com/llvm/llvm-project/commit/3d7383d7f44a4b9760f6566e62950968e90e0a1c
DIFF: https://github.com/llvm/llvm-project/commit/3d7383d7f44a4b9760f6566e62950968e90e0a1c.diff
LOG: [mlir][affine] Prevent vectorizer test from crash without any map
If the vectorizer test pass does not get any affine map, it should output nothing instead of crash.
Issue: https://github.com/llvm/llvm-project/issues/61534
Reviewed By: nicolasvasilache, dcaballe
Differential Revision: https://reviews.llvm.org/D146601
Added:
Modified:
mlir/test/Dialect/Affine/SuperVectorize/compose_maps.mlir
mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp
Removed:
################################################################################
diff --git a/mlir/test/Dialect/Affine/SuperVectorize/compose_maps.mlir b/mlir/test/Dialect/Affine/SuperVectorize/compose_maps.mlir
index 3b7820cec67a2..b53fc55fdac91 100644
--- a/mlir/test/Dialect/Affine/SuperVectorize/compose_maps.mlir
+++ b/mlir/test/Dialect/Affine/SuperVectorize/compose_maps.mlir
@@ -159,3 +159,11 @@ func.func @multi_symbols() {
"test_affine_map"() { affine_map = affine_map<(d0, d1)[s0, s1] -> (d0 + 1 + s1, d1 - 1 - s0)> } : () -> ()
return
}
+
+// -----
+
+// CHECK-LABEL: @no_affine_maps
+func.func @no_affine_maps() {
+ // CHECK: return
+ return
+}
diff --git a/mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp b/mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp
index 61428bbf7091f..b31dd3f7d866f 100644
--- a/mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp
+++ b/mlir/test/lib/Dialect/Affine/TestVectorizationUtils.cpp
@@ -215,6 +215,9 @@ void VectorizerTestPass::testComposeMaps(llvm::raw_ostream &outs) {
.getValue();
maps.push_back(map);
}
+ if (maps.empty())
+ // Nothing to compose
+ return;
AffineMap res;
for (auto m : maps) {
res = res ? res.compose(m) : m;
More information about the Mlir-commits
mailing list