[LLVMdev] Is there pass to break down <4 x float> to scalars

Richard Sandiford rsandifo at linux.vnet.ibm.com
Fri Oct 25 03:06:10 PDT 2013


Liu Xin <navy.xliu at gmail.com> writes:
> Hi, LLVM community,
>
> I write some code in hand using LLVM IR. for simplicity, I write them in <4
> x float>. now I found some stores for elements are useless.
>
> for example, If I store {0.0, 1.0, 2.0, 3.0} to a <4 x float> %a. maybe
> only %a.xy is alive in my program.  our target doesn't feature SIMD
> instruction, which means we have to lower vector to many  scalar
> instructions. I found llvm doesn't have DSE in codegen , right?
>
>
> Is there a pass which can break down vector operation to scalars?

I wanted the same thing for SystemZ, which doesn't have vectors,
in order to improve the llvmpipe code.  FWIW, here's what I have locally.

It is able to decompose loads and stores, but I found in the llvmpipe case
that this made things worse with TBAA, because DAGCombiner::GaterAllAliases
has some fairly strict limits.  So I disabled that by default; use
-decompose-vector-load-store to reenable.

The main motivation for z was instead to get InstCombine to rewrite
things like scalarised selects.

I haven't submitted it yet because it's less of a win than the TBAA
DAGCombiner patch I posted, so I didn't want to distract from that.
It would also need some TargetTransformInfo hooks to decide which
vectors should be decomposed.

Thanks,
Richard

-------------- next part --------------
A non-text attachment was scrubbed...
Name: decompose-vectors.diff
Type: text/x-patch
Size: 32835 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131025/ce62d95a/attachment.bin>


More information about the llvm-dev mailing list