[PATCH] D132208: [LoopIntWrapPredication] Loop Integer Wrapping Predication Pass

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 23 08:20:22 PDT 2022


craig.topper added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/LoopIntWrapPredication.cpp:246
+  BasicBlock *Preheader = L.getLoopPreheader();
+  assert(Preheader);
+  Instruction *Loc = Preheader->getTerminator();
----------------
kachkov98 wrote:
> craig.topper wrote:
> > What guarantees the loop has a preheader? Placement in the pipeline would probably guarantee it but I'm not sure anything does when running the pass by itself. Unless I missed something.
> Loop Pass Manager should run LoopSimplify pass, and this cannonical form ensures that loop has a preheader: https://llvm.org/docs/LoopTerminology.html#loop-simplify-form
I agree that it works if run as part of the Loop Pass Manager. But if you run the pass standalone from the opt command line, it may not be in loop simplify form. The pass either needs to protect itself or require the LoopSimplify analysis.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132208



More information about the llvm-commits mailing list