[PATCH] D71165: [LoopFusion] Move instructions from FC0.Latch to FC1.Latch.

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 17 12:33:56 PST 2019


Meinersbur accepted this revision.
Meinersbur added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/LoopFuse.cpp:1134
+  void moveInsts(BasicBlock &FromBB, BasicBlock &ToBB, DomTreeUpdater &DTU) {
+    for (auto It = ++FromBB.rbegin(); It != FromBB.rend();) {
+      Instruction *MovePos = ToBB.getFirstNonPHIOrDbg();
----------------
Whitney wrote:
> Meinersbur wrote:
> > [style]
> > ```
> > for (Instruction &I : drop_begin(reverse(FromBB), 1))
> > ```
> `It` need to be incremented before `moveBefore` as it move instructions out of FromBB.
Could you add a comment about why the Iterator is incremented where it is? I usually try to avoid iterator magic.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71165





More information about the llvm-commits mailing list