[PATCH] D108114: [LoopPeel] Peel if it turns invariant loads dereferenceable.

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 29 22:08:11 PDT 2021


mkazantsev added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/LoopPeel.cpp:164
+// Try to find any invariant memory reads that will become dereferenceable in
+// the remainder loop after peeling.
+static unsigned peelToTurnInvariantLoadsDerefencebale(Loop &L,
----------------
Returns... ? Is that supposed to be boolean?


================
Comment at: llvm/lib/Transforms/Utils/LoopPeel.cpp:176
+  assert(L.isLoopExiting(Latch) &&
+         "only multi-exit loops where the latch exits are supported for now");
+
----------------
Can it be a single-exit loop where latch doesn't exit?


================
Comment at: llvm/lib/Transforms/Utils/LoopPeel.cpp:201
+        if (DT.dominates(BB, Latch) &&
+            SE.isLoopInvariant(SE.getSCEV(LI->getPointerOperand()), &L))
+          ReadTurnsDeref = true;
----------------
Does this actually lead to the effect you are aiming? Some complexly computed pointer (e.g. result of chain of geps) may be proven loop-invariant by SCEV, but how other passes will figure out this load is from a dereferenceable pointer?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108114



More information about the llvm-commits mailing list