[llvm] [LoopPeel] Added support for cases where PhiAnalyzer contains Induction PHI (PR #94900)

Madhur Amilkanthwar via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 26 22:31:21 PDT 2024


================
@@ -217,33 +218,39 @@ PhiAnalyzer::PeelCounter PhiAnalyzer::calculate(const Value &V) {
   if (L.isLoopInvariant(&V))
     // Loop invariant so known at start.
     return (IterationsToInvariance[&V] = 0);
-  if (const PHINode *Phi = dyn_cast<PHINode>(&V)) {
+  if (PHINode *Phi = dyn_cast<PHINode>(&V)) {
     if (Phi->getParent() != L.getHeader()) {
       // Phi is not in header block so Unknown.
       assert(IterationsToInvariance[&V] == Unknown && "unexpected value saved");
       return Unknown;
     }
+
+    // If Induction PHI, register as a starting point.
----------------
madhur13490 wrote:

Thanks. Looks good.

Have you measured the impact of the patch on key benchmarks? LLVM test-suite is a suite to make sure we don't regress.

https://github.com/llvm/llvm-project/pull/94900


More information about the llvm-commits mailing list