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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 3 02:45:16 PST 2024


fhahn wrote:

> @fhahn Ping. Are you happy with the changes?

What are your thoughts about the below? For that, we would need a case that gets vectorized with the change.

>> 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.
> I don't think this would apply, since nothing gets vectorized in the minimal X86 example, and I don't think we need an example showing vectorization to fix the bug.

Ideally we would have a test for both cases that are impacted by the patch: vectorizing with the new cost and also not vectorizing (and not crashing).

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


More information about the llvm-commits mailing list