[PATCH] D60565: [LOOPINFO] Extend Loop object to add utilities to get the loop bounds, step, induction variable, and guard branch.

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 11 14:18:26 PDT 2019


jdoerfert added inline comments.


================
Comment at: llvm/include/llvm/Analysis/LoopInfo.h:620
+
+  /// Return the loop induction variable if found, else return nullptr.
+  /// An instruction is considered as induction variable if
----------------
Whitney wrote:
> jdoerfert wrote:
> > "The" loop induction variable, or "any" loop induction variable. There could easily be two or more.
> In this context, loop induction variable is defined as the the phi node in the loop header which is used in the condition of the conditional branch in the loop latch, so should only be one.
```
for (i = 0, j = N; i < j; i++,j--)
  body(i,j);
```


================
Comment at: llvm/include/llvm/Analysis/LoopInfo.h:635
+  bool isAuxiliaryInductionVariable(PHINode &AuxIndVar,
+                                    ScalarEvolution *SE = nullptr) const;
+
----------------
Whitney wrote:
> jdoerfert wrote:
> > Why is it called auxiliary and what happens if you call it with the only induction variable?
> Auxiliary induction variable doesn't require to be used in the loop latch condition.
Can you mention that and thereby make it explicit. 


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60565/new/

https://reviews.llvm.org/D60565





More information about the llvm-commits mailing list