[PATCH] D151866: [LoopPeel] Reduce peel count for chains of invariant phis.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 1 00:17:11 PDT 2023


fhahn added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/LoopPeel.cpp:233
+      if (Phi->getParent() == PhiInput->getParent() &&
+          PhiInput->comesBefore(Phi))
+        // If the input is from a previous phi in the same block, Phi becomes
----------------
The current patch doesn't apply cleanly on `main` so I cannot check, but is this covered by a test?


================
Comment at: llvm/lib/Transforms/Utils/LoopPeel.cpp:236
+        // loop invariant in the same iteration.
+        return (IterationsToInvariance[Phi] = Iterations);
     return (IterationsToInvariance[Phi] = addOne(Iterations));
----------------
nit: redundant ()


================
Comment at: llvm/test/Transforms/LoopUnroll/peel-loop-not-forced.ll:387
   %cmp = icmp slt i32 %i, 1000
 
+  %phibackedge1 = add i32 %half.inv, 1
----------------
Can the new tests/this change be done separately?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151866



More information about the llvm-commits mailing list