Skip to content

Commit 5a05fa1

Browse files
[mlir][bufferize] Delete getCalledFunction in drop-equivalent-buffer-results pass (NFC) (#162432)
Use resolveCallable replace getCalledFunction.
1 parent 885d416 commit 5a05fa1

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

mlir/lib/Dialect/Bufferization/Transforms/DropEquivalentBufferResults.cpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,24 +55,15 @@ static func::ReturnOp getAssumedUniqueReturnOp(func::FuncOp funcOp) {
5555
return returnOp;
5656
}
5757

58-
/// Return the func::FuncOp called by `callOp`.
59-
static func::FuncOp getCalledFunction(CallOpInterface callOp) {
60-
SymbolRefAttr sym =
61-
llvm::dyn_cast_if_present<SymbolRefAttr>(callOp.getCallableForCallee());
62-
if (!sym)
63-
return nullptr;
64-
return dyn_cast_or_null<func::FuncOp>(
65-
SymbolTable::lookupNearestSymbolFrom(callOp, sym));
66-
}
67-
6858
LogicalResult
6959
mlir::bufferization::dropEquivalentBufferResults(ModuleOp module) {
7060
IRRewriter rewriter(module.getContext());
7161

7262
DenseMap<func::FuncOp, DenseSet<func::CallOp>> callerMap;
7363
// Collect the mapping of functions to their call sites.
7464
module.walk([&](func::CallOp callOp) {
75-
if (func::FuncOp calledFunc = getCalledFunction(callOp)) {
65+
if (func::FuncOp calledFunc =
66+
dyn_cast_or_null<func::FuncOp>(callOp.resolveCallable())) {
7667
callerMap[calledFunc].insert(callOp);
7768
}
7869
});

0 commit comments

Comments
 (0)