[llvm] [VPlan] Fix mutating whilst iterating over users in EVL transform (PR #122885)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 14 04:16:00 PST 2025


================
@@ -1603,7 +1603,7 @@ static void transformRecipestoEVLRecipes(VPlan &Plan, VPValue &EVL) {
   LLVMContext &Ctx = CanonicalIVType->getContext();
   VPValue *AllOneMask = Plan.getOrAddLiveIn(ConstantInt::getTrue(Ctx));
 
-  for (VPUser *U : Plan.getVF().users()) {
+  for (VPUser *U : SmallVector<VPUser *>(Plan.getVF().users())) {
----------------
fhahn wrote:

```suggestion
  for (VPUser *U : to_vector(Plan.getVF().users())) {
```

Should be possible to use `to_vector` I think

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


More information about the llvm-commits mailing list