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

Sergei Kachkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 22 01:03:56 PDT 2022


kachkov98 marked 2 inline comments as done.
kachkov98 added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/LoopIntWrapPredication.cpp:70
+  if (Opc != Instruction::Add && Opc != Instruction::Sub &&
+      Opc != Instruction::Mul)
+    return nullptr;
----------------
craig.topper wrote:
> The description on line 32 mentions `shl`, but `Shl` isn't here
It looks like processing of shl is not profitable, since it's not handled by SimplifyIndVar (https://llvm.org/doxygen/SimplifyIndVar_8cpp_source.html#l01551)


================
Comment at: llvm/lib/Transforms/Scalar/LoopIntWrapPredication.cpp:246
+  BasicBlock *Preheader = L.getLoopPreheader();
+  assert(Preheader);
+  Instruction *Loc = Preheader->getTerminator();
----------------
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


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