[PATCH] D114916: [LoopInterchange] Enable loop interchange with multiple outer loop indvars

Bardia Mahjour via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 23 13:39:39 PST 2021


bmahjour added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/LoopInterchange.cpp:841
 
-  // TODO: Currently we handle only loops with 1 induction variable.
-  if (Inductions.size() != 1) {
-    LLVM_DEBUG(dbgs() << "Loops with more than 1 induction variables are not "
-                      << "supported currently.\n");
-    ORE->emit([&]() {
-      return OptimizationRemarkMissed(DEBUG_TYPE, "MultiIndutionOuter",
-                                      OuterLoop->getStartLoc(),
-                                      OuterLoop->getHeader())
-             << "Only outer loops with 1 induction variable can be "
-                "interchanged currently.";
-    });
-    return true;
-  }
+  OuterLoopInductions = Inductions;
 
----------------
this imposes an ordering constraint...the OuterLoopInduction member variable is invalid until we get here. It would be cleaner to introduce an initialization step before calling either `urrentLimitations()` or `adjustLoopBranches()`.


================
Comment at: llvm/test/Transforms/LoopInterchange/interchangeable-outerloop-multiple-indvars.ll:13
+; void fn1() {
+;  for (; c && e; c++,e++) {
+;    d = 5;
----------------
can these tests be changed to something more canonical (eg not relying on zero initialization of globals, and signed integer wrap for termination)?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114916



More information about the llvm-commits mailing list