[llvm] [LV] Fix issue in VPFirstOrderRecurrencePHIRecipe::usesFirstLaneOnly (PR #179977)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 9 03:23:20 PST 2026
================
@@ -654,6 +654,9 @@ void VPlanTransforms::replicateByVF(VPlan &Plan, ElementCount VF) {
ToRemove.push_back(DefR);
}
}
- for (auto *R : reverse(ToRemove))
+ for (auto *R : reverse(ToRemove)) {
+ assert(!cast<VPSingleDefRecipe>(R)->getNumUsers() &&
+ "Attempting to remove a VPSingleDefRecipe with users!");
----------------
david-arm wrote:
OK fair enough. I'm happy to remove it. I'm just concerned that this code is quite fragile due to this:
```
DefR->replaceUsesWithIf(LaneDefs[0], [DefR](VPUser &U, unsigned) {
return U.usesFirstLaneOnly(DefR);
});
```
because if any instance `U.usesFirstLaneOnly` actually returns false we may trigger the assert in `~VPRecipeValue`. I plan to look at this a bit more after this PR lands because I wonder if this should just be something like:
```
DefR->replaceUsesWithIf(LaneDefs[0], [DefR](VPUser &U, unsigned) {
assert(U.usesFirstLaneOnly(DefR));
return true;
});
```
https://github.com/llvm/llvm-project/pull/179977
More information about the llvm-commits
mailing list