ValueRange composeSyms =
affineApply.getMapOperands().take_back(composeMap.getNumSymbols());
- // Perform the replacement and append the dims and symbols where relevant.
+ // Append the dims and symbols where relevant and perform the replacement.
MLIRContext *ctx = map->getContext();
AffineExpr toReplace = isDimReplacement ? getAffineDimExpr(pos, ctx)
: getAffineSymbolExpr(pos, ctx);
- *map = map->replace(toReplace, composeExpr, dims.size(), syms.size());
dims.append(composeDims.begin(), composeDims.end());
syms.append(composeSyms.begin(), composeSyms.end());
+ *map = map->replace(toReplace, composeExpr, dims.size(), syms.size());
return success();
}