================ @@ -24,7 +25,82 @@ namespace flangomp { namespace { namespace looputils { -using LoopNest = llvm::SetVector<fir::DoLoopOp>; +/// Stores info needed about the induction/iteration variable for each `do +/// concurrent` in a loop nest. This includes only for now: +/// * the operation allocating memory for iteration variable, +struct InductionVariableInfo { + mlir::Operation *iterVarMemDef; +}; + +using LoopNestToIndVarMap = + llvm::MapVector<fir::DoLoopOp, InductionVariableInfo>; + +/// Given an operation `op`, this returns true if one of `op`'s operands is +/// "ultimately" the loop's induction variable. This helps in cases where the +/// induction variable's use is "hidden" behind a convert/cast. +/// +/// For example, give the following loop: +/// ``` +/// fir.do_loop %ind_var = %lb to %ub step %s unordered { +/// %ind_var_conv = fir.convert %ind_var : (index) -> i32 +/// fir.store %ind_var_conv to %i#1 : !fir.ref<i32> +/// ... +/// } +/// ``` +/// +/// If \p op is the `fir.store` operation, then this function will return true +/// since the IV is the "ultimate" opeerand to the `fir.store` op through the ---------------- skatrak wrote:
```suggestion /// since the IV is the "ultimate" operand to the `fir.store` op through the ``` https://github.com/llvm/llvm-project/pull/127633 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits