[llvm] [LV] Keep duplicate recipes in VPExpressionRecipe (PR #156976)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 22 07:38:20 PDT 2025


https://github.com/fhahn commented:

> > Hmm, this only impacts printing, right? It seems like it would be simpler to just handle the case where 1 extend is shared when picking the multiply recipe, by checking if `ExpressionRecipes[1]` is an extend or widen recipe?
> > ```
> >   auto *Mul = cast<VPWidenRecipe>(IsExtended ? ExpressionRecipes[2]
> >                                                : ExpressionRecipes[0]);
> > ```
> 
> I think it's best to get the vector of recipes correct from the start so that we don't need to account for unexpectedness in other places. This could theoretically happen for future bundle types too and we don't want lots of checks when we can just get it right from the start of the bundle's existence.

But it looks like handling duplicates requires quite a bit of extra complexity spread throughout; ideally there would be no need to look up the individual entries in the expression list.

At the moment this just impacts printing. IMO it would be better to just have a generic print function that does not inspect the entries directly, but instead prints something like

```
EXPRESSION vp<%x> = ExtendedReduction operands {
  bundled recipes...
}
```

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


More information about the llvm-commits mailing list