[Mlir-commits] [mlir] [mlir] Use getArgNumber to get argument index (NFC) (PR #162959)
lonely eagle
llvmlistbot at llvm.org
Fri Oct 10 20:26:50 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;
----------------
linuxlonelyeagle wrote:
Thank you for pointing this out. However, there's a fact that the tests for loop-invariant-subset-hoisting only include scf.for. Is this pass designed solely for scf.for loops?
https://github.com/llvm/llvm-project/pull/162959
More information about the Mlir-commits
mailing list