[PATCH] D91682: [LoopInterchange] Fix the checking of tightly nested loop

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 18 12:13:04 PST 2020


fhahn added inline comments.


================
Comment at: llvm/lib/Analysis/LoopNestAnalysis.cpp:129
+      Instruction *StepInst = ID.getInductionBinOp();
+      if ((isa<BinaryOperator>(I) && &I != StepInst &&
+           !(InnerLoop.isLoopInvariant(I.getOperand(0)) &&
----------------
Whitney wrote:
> This change the current definition of perfect loop nest.
> Why do you think we should consider loop nest as perfect with inner loop invariant binary operator in between the outer and inner loop?
> If all loops in the loop nest are LCSSA, then the only possible users of instructions defined in the inner loop is phi nodes at inner loop exit block. which makes all binary operator operands to be inner loop invariant.
I think LoopInterchange uses a slightly more relaxed 'tightly nested' criteria. How much work would it be to check that the path from inner loop exit to outer loop latch?


================
Comment at: llvm/lib/Transforms/Scalar/LoopInterchange.cpp:610
-  // and outer loop latch doesn't contain any unsafe instructions.
-  if (containsUnsafeInstructions(OuterLoopHeader) ||
-      containsUnsafeInstructions(OuterLoopLatch))
----------------
are those checks included in the new checks?


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

https://reviews.llvm.org/D91682



More information about the llvm-commits mailing list