[llvm] [VPlan] Optimize resume values of IVs together with other exit values. (PR #174239)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 3 07:02:21 PST 2026


================
@@ -742,6 +751,30 @@ void VPlanTransforms::createHeaderPhiRecipes(
     PhiR->replaceAllUsesWith(HeaderPhiR);
     PhiR->eraseFromParent();
   }
+
+  for (const auto &[HeaderPhiR, ScalarPhiR] : zip_equal(
+           drop_begin(HeaderVPBB->phis()), Plan.getScalarPreheader()->phis())) {
----------------
david-arm wrote:

Hmm, this is the second time I've seen `drop_begin(HeaderVPBB->phis())` in this patch. Is this dropping the canonical IV, which isn't present in the scalar loop? If so, would it be useful to have a helper function in VPBasicBlock called `getMatchingPhisForScalarLoop()` or something like that? It's just a bit easier to understand what's going and why the first phi is being dropped.

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


More information about the llvm-commits mailing list