[LLVMdev] SelectionDAG scalarizes vector operations.

Duncan Sands baldrick at free.fr
Thu Feb 9 01:07:21 PST 2012


Hi Ayal, thanks for this interesting information.

>>>> We choose a vectorization factor which is likely to generate more
>>>> legal vector types, but if the user mixes types then we are forced to
>>>> make a decision.  We rely on the LLVM code generator to produce
>>>> quality code.  To my understanding, the GCC vectorizer does not
>>>> vectorize code if it thinks that it misses a single operation.
>>>
>
> Right. It queries whether the target supports a vectorized form (of the desired vectorization factor) for each scalar instruction in the loop or region. There is no scalarization -- code is either fully vectorized in a way that survives code generation, or else the vectorizer gives up and avoids modifying the relevant scalar code. This may indeed not be an optimal decision; but even then, there are cases where it's better not to vectorize.

The problem right now is that LLVM's codegen takes the vector IR produced by
GCC and often scalarizes it.

Ciao, Duncan.



More information about the llvm-dev mailing list