@@ -59,8 +59,9 @@ static SmallVector<Value> getDynamicSize(Value memref, func::FuncOp funcOp) {
59
59
if (!sizeSrc)
60
60
return {};
61
61
62
- auto iter = llvm::find (funcOp.getArguments (), sizeSrc);
63
- if (!iter)
62
+ auto arguments = funcOp.getArguments ();
63
+ auto iter = llvm::find (arguments, sizeSrc);
64
+ if (iter == arguments.end ())
64
65
return {};
65
66
dynamicSizes.push_back (*iter);
66
67
}
@@ -74,10 +75,8 @@ static SmallVector<Value> mapDynamicSizeAtCaller(func::CallOp call,
74
75
ValueRange dynamicSizes) {
75
76
SmallVector<Value> mappedDynamicSizes;
76
77
for (Value size : dynamicSizes) {
77
- auto callOperands = call.getOperands ();
78
- for (size_t i = 0 , e = callOperands.size (); i < e; ++i) {
79
- Value src = callOperands[i];
80
- BlockArgument dst = callee.getArgument (i);
78
+ for (auto [src, dst] :
79
+ llvm::zip_first (call.getOperands (), callee.getArguments ())) {
81
80
if (size != dst)
82
81
continue ;
83
82
mappedDynamicSizes.push_back (src);
@@ -202,7 +201,7 @@ updateReturnOps(func::FuncOp func, ArrayRef<BlockArgument> appendedEntryArgs,
202
201
// Updates all CallOps in the scope of the given ModuleOp by allocating
203
202
// temporary buffers for newly introduced out params.
204
203
static LogicalResult
205
- updateCalls (ModuleOp module , AllocDynamicSizesMap &map,
204
+ updateCalls (ModuleOp module , const AllocDynamicSizesMap &map,
206
205
const bufferization::BufferResultsToOutParamsOpts &options) {
207
206
bool didFail = false ;
208
207
SymbolTable symtab (module );
0 commit comments