[PATCH] D90940: [LoopFlatten] Make it a FunctionPass

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 6 07:08:05 PST 2020


dmgreen added inline comments.


================
Comment at: llvm/include/llvm/Transforms/Scalar.h:334
+//
+FunctionPass *createLoopFlattenPass();
+
----------------
Is there an important ordering to this file? It's not alphabetical..

Any reason why it's moved?


================
Comment at: llvm/lib/Transforms/Scalar/LoopFlatten.cpp:535
+  bool Changed = false;
+  for (auto *OuterLoop : LI->getTopLevelLoops()) {
+    if (OuterLoop->getSubLoops().size() != 1)
----------------
Should this be handling sub-loops too? Maybe use getLoopsInPreorder if that works how I think it does?


================
Comment at: llvm/lib/Transforms/Scalar/LoopFlatten.cpp:572
   void getAnalysisUsage(AnalysisUsage &AU) const override {
     getLoopAnalysisUsage(AU);
     AU.addRequired<TargetTransformInfoWrapperPass>();
----------------
Does this preserve all the things a loop pass would? I think the answer is yes, but it's perhaps worth checking. LI seems to  be kept up to date, which was the one I was worried about.


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

https://reviews.llvm.org/D90940



More information about the llvm-commits mailing list