[PATCH] D22630: Loop rotation

Hal Finkel via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 18 12:38:56 PDT 2016


hfinkel added inline comments.


================
Comment at: llvm/lib/Analysis/LoopInfo.cpp:225
           LoopID = MD;
+          I = TI;
+        }
----------------
hiraditya wrote:
> mzolotukhin wrote:
> > What if a loop has two backedges? `LoopID` would be the same for both of them, but `TI` obviously would be different.
> If multiple instructions are branching to the loop-header with via a back-edge, I think, that means there are two different loops.
No, you can have a loop with multiple backedges. Backedges, by definition, go to the loop header. We have two functions in LoopInfo:

  /// If there is a single latch block for this loop, return it.
  /// A latch block is a block that contains a branch back to the header.
  BlockT *getLoopLatch() const;

  /// Return all loop latch blocks of this loop. A latch block is a block that
  /// contains a branch back to the header.
  void getLoopLatches(SmallVectorImpl<BlockT *> &LoopLatches) const {
    ...


https://reviews.llvm.org/D22630





More information about the llvm-commits mailing list