[llvm] LoopVectorize: fix phi cost when it is scalar after vectorization (PR #74456)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 12 10:52:06 PST 2023


fhahn wrote:

> However, if it also satisfies the condition isScalarAfterVectorization, this cost is incorrect, as it won't be converted into a shuffle. Fix the cost.

Hmm, is this correct? It looks like in the VPlan, there's 

```
FIRST-ORDER-RECURRENCE-PHI ir<%idx.ext.merge> = phi ir<1>, ir<%idx>
EMIT vp<%8> = first-order splice ir<%idx.ext.merge>, ir<%idx>
```

so a vector phi and shuffle should be generated. It may be good to also add a use of the recurrence to the test, the load and GEP will get DCE'd.

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


More information about the llvm-commits mailing list