[Mlir-commits] [mlir] [mlir] Use getArgNumber to get argument index (NFC) (PR #162959)
Matthias Springer
llvmlistbot at llvm.org
Thu Oct 23 05:40:19 PDT 2025
================
@@ -324,8 +324,7 @@ static LoopLikeOpInterface hoistSubsetAtIterArg(RewriterBase &rewriter,
LoopLikeOpInterface loopLike,
BlockArgument iterArg) {
assert(iterArg.getOwner()->getParentOp() == loopLike && "invalid iter_arg");
- BlockArgument *it = llvm::find(loopLike.getRegionIterArgs(), iterArg);
- int64_t iterArgIdx = std::distance(loopLike.getRegionIterArgs().begin(), it);
+ int64_t iterArgIdx = iterArg.getArgNumber() - 1;
----------------
matthias-springer wrote:
As long as the function operates on `LoopLikeOpInterface`, I think the implementation should be generic enough to handle all possible loops.
https://github.com/llvm/llvm-project/pull/162959
More information about the Mlir-commits
mailing list