Skip to content

[mlir][bufferization][NFC] Clean up code #78594

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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())
Expand Down