[Mlir-commits] [mlir] [mlir][tensor] Fold when source is const (PR #71643)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Nov 8 01:40:42 PST 2023
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 1a4754c8c8bceede7d7b9644bc34b44b027e0d23 4c021b09cb2fe6adeec4a9b6be863000e93d59cc -- mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp b/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
index c33dd603cb02..eec89be74b88 100644
--- a/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
+++ b/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
@@ -835,9 +835,10 @@ void EmptyOp::getCanonicalizationPatterns(RewritePatternSet &results,
}
/// Try to remove a tensor operation if it would only reshape a constant.
-/// Removes the op and replaces the constant with a new constant of the result shape.
+/// Removes the op and replaces the constant with a new constant of the result
+/// shape.
static OpFoldResult reshapeConstantSource(DenseElementsAttr source,
- TensorType result) {
+ TensorType result) {
if (source && source.isSplat() && result.hasStaticShape())
return source.resizeSplat(result);
``````````
</details>
https://github.com/llvm/llvm-project/pull/71643
More information about the Mlir-commits
mailing list