[Mlir-commits] [mlir] 88bc92e - [mlir][bufferization] Fix insertion point issue in EliminateEmptyTensors
Matthias Springer
llvmlistbot at llvm.org
Thu Jul 6 07:20:09 PDT 2023
Author: Matthias Springer
Date: 2023-07-06T16:20:01+02:00
New Revision: 88bc92e8fca046b226ffc8e08c74909ada3c35dd
URL: https://github.com/llvm/llvm-project/commit/88bc92e8fca046b226ffc8e08c74909ada3c35dd
DIFF: https://github.com/llvm/llvm-project/commit/88bc92e8fca046b226ffc8e08c74909ada3c35dd.diff
LOG: [mlir][bufferization] Fix insertion point issue in EliminateEmptyTensors
The replacement op insertion point was off by one.
Differential Revision: https://reviews.llvm.org/D154608
Added:
Modified:
mlir/lib/Dialect/Bufferization/Transforms/EmptyTensorElimination.cpp
mlir/test/Dialect/Bufferization/Transforms/one-shot-bufferize-empty-tensor-elimination.mlir
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/EmptyTensorElimination.cpp b/mlir/lib/Dialect/Bufferization/Transforms/EmptyTensorElimination.cpp
index 76d424867af614..6aa256881b5c66 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/EmptyTensorElimination.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/EmptyTensorElimination.cpp
@@ -39,7 +39,7 @@ neededValuesDominateInsertionPoint(const DominanceInfo &domInfo,
return false;
} else {
auto opResult = cast<OpResult>(val);
- if (!domInfo.dominates(opResult.getOwner(), insertionPoint))
+ if (!domInfo.properlyDominates(opResult.getOwner(), insertionPoint))
return false;
}
}
diff --git a/mlir/test/Dialect/Bufferization/Transforms/one-shot-bufferize-empty-tensor-elimination.mlir b/mlir/test/Dialect/Bufferization/Transforms/one-shot-bufferize-empty-tensor-elimination.mlir
index ca4ae40f44b7d3..785062ba4c227e 100644
--- a/mlir/test/Dialect/Bufferization/Transforms/one-shot-bufferize-empty-tensor-elimination.mlir
+++ b/mlir/test/Dialect/Bufferization/Transforms/one-shot-bufferize-empty-tensor-elimination.mlir
@@ -259,3 +259,17 @@ func.func @regression_eliminate_equivalent_only(%sz: index, %p: index, %t0: tens
}
func.return %28 : tensor<?x16xi8>
}
+
+// -----
+
+// CHECK-LABEL: func.func @regression_multiple_insertion_points(
+// CHECK-NOT: memref.alloc
+func.func @regression_multiple_insertion_points(%t1: tensor<?x?xf32>) -> tensor<?x?xf32> {
+ %empty = tensor.empty() : tensor<2x5xf32>
+ %f0 = arith.constant 5.5 : f32
+ %0 = "test.foo"() : () -> (index)
+ %1 = "test.bar"() : () -> (index)
+ %filled = linalg.fill ins(%f0 : f32) outs(%empty : tensor<2x5xf32>) -> tensor<2x5xf32>
+ %2 = tensor.insert_slice %filled into %t1 [%0, %1] [2, 5] [1, 1] : tensor<2x5xf32> into tensor<?x?xf32>
+ return %2 : tensor<?x?xf32>
+}
More information about the Mlir-commits
mailing list