[Mlir-commits] [mlir] [mlir][bufferization][WIP] Clean up code (PR #78594)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Jan 18 07:06:00 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
Author: Matthias Springer (matthias-springer)
<details>
<summary>Changes</summary>
Clean up code and remove dead code.
---
Full diff: https://github.com/llvm/llvm-project/pull/78594.diff
3 Files Affected:
- (modified) mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h (-3)
- (modified) mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp (-7)
- (modified) mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocationSimplification.cpp (+2-8)
``````````diff
diff --git a/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h b/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h
index 63e2d19e68ef97..226a2fbd08563c 100644
--- a/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h
+++ b/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h
@@ -375,9 +375,6 @@ struct BufferizationOptions {
SmallVector<AnalysisStateInitFn> stateInitializers;
};
-/// Return `true` if the given value is a BlockArgument of a func::FuncOp.
-bool isFunctionArgument(Value value);
-
/// Traversal parameters for `findValueInReverseUseDefChain`.
struct TraversalConfig {
/// Specifies if leaves (that do not have further OpOperands to follow)
diff --git a/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp b/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp
index a0bb8715f2c561..5271de1a68c6c6 100644
--- a/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp
+++ b/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp
@@ -759,13 +759,6 @@ LogicalResult BufferizationOptions::createMemCpy(OpBuilder &b, Location loc,
// Bufferization-specific IRMapping support with debugging.
//===----------------------------------------------------------------------===//
-bool bufferization::isFunctionArgument(Value value) {
- auto bbArg = llvm::dyn_cast<BlockArgument>(value);
- if (!bbArg)
- return false;
- return isa<func::FuncOp>(bbArg.getOwner()->getParentOp());
-}
-
BaseMemRefType bufferization::getMemRefType(Value value,
const BufferizationOptions &options,
MemRefLayoutAttrInterface layout,
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocationSimplification.cpp b/mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocationSimplification.cpp
index 42653517249d66..16ce4b59b6ab11 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocationSimplification.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocationSimplification.cpp
@@ -240,13 +240,6 @@ struct RemoveRetainedMemrefsGuaranteedToNotAlias
LogicalResult matchAndRewrite(DeallocOp deallocOp,
PatternRewriter &rewriter) const override {
SmallVector<Value> newRetainedMemrefs, replacements;
- Value falseValue;
- auto getOrCreateFalse = [&]() -> Value {
- if (!falseValue)
- falseValue = rewriter.create<arith::ConstantOp>(
- deallocOp.getLoc(), rewriter.getBoolAttr(false));
- return falseValue;
- };
for (auto retainedMemref : deallocOp.getRetained()) {
if (potentiallyAliasesMemref(aliasAnalysis, deallocOp.getMemrefs(),
@@ -256,7 +249,8 @@ struct RemoveRetainedMemrefsGuaranteedToNotAlias
continue;
}
- replacements.push_back(getOrCreateFalse());
+ replacements.push_back(rewriter.create<arith::ConstantOp>(
+ deallocOp.getLoc(), rewriter.getBoolAttr(false)));
}
if (newRetainedMemrefs.size() == deallocOp.getRetained().size())
``````````
</details>
https://github.com/llvm/llvm-project/pull/78594
More information about the Mlir-commits
mailing list