[Mlir-commits] [mlir] 4fc128f - [mlir][bufferization][NFC] Clean up code (#78594)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Fri Jan 19 01:20:46 PST 2024
Author: Matthias Springer
Date: 2024-01-19T10:20:41+01:00
New Revision: 4fc128f817b425657049922175619addb04c8f41
URL: https://github.com/llvm/llvm-project/commit/4fc128f817b425657049922175619addb04c8f41
DIFF: https://github.com/llvm/llvm-project/commit/4fc128f817b425657049922175619addb04c8f41.diff
LOG: [mlir][bufferization][NFC] Clean up code (#78594)
Clean up code and remove dead code.
Added:
Modified:
mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h
mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp
mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocationSimplification.cpp
Removed:
################################################################################
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 4b1dfee4a2b926..6ca9702cbbc66b 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 75d65193809f10..4d1e21c2e406cd 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())
More information about the Mlir-commits
mailing list