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

Madhur Amilkanthwar via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 25 21:33:22 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:

I think a comment explaining some more context would be useful. May be copy the comments from the test here too as they provide the motivation?

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


More information about the llvm-commits mailing list