[llvm] [VPlan] Collect FOR PHIs before sinking/hoisting recurrence users (PR #194671)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 30 22:52:37 PDT 2026
================
@@ -869,11 +869,13 @@ static bool hoistPreviousBeforeFORUsers(VPFirstOrderRecurrencePHIRecipe *FOR,
/// fails.
static bool tryToSinkOrHoistRecurrenceUsers(VPBasicBlock *HeaderVPBB,
VPDominatorTree &VPDT) {
- for (VPRecipeBase &R : HeaderVPBB->phis()) {
- auto *FOR = dyn_cast<VPFirstOrderRecurrencePHIRecipe>(&R);
- if (!FOR)
- continue;
+ SmallVector<VPFirstOrderRecurrencePHIRecipe *> FORs;
+
+ for (VPRecipeBase &R : HeaderVPBB->phis())
+ if (auto *FOR = dyn_cast<VPFirstOrderRecurrencePHIRecipe>(&R))
+ FORs.push_back(FOR);
+ for (VPFirstOrderRecurrencePHIRecipe *FOR : FORs) {
----------------
xiongzile wrote:
Good point.
https://github.com/llvm/llvm-project/pull/194671
More information about the llvm-commits
mailing list