This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Also sink a splat for the first operand of instructions with vector-scalar cases
Needs ReviewPublic

Authored by rogfer01 on Mar 7 2022, 6:21 AM.

Details

Summary

In D117703 we were limited by the handling of commutative nodes in ISel, so we avoided sinking the first operand.

D117955 landed and lifted this limitation so we can sink the first operand too.

Diff Detail

Event Timeline

rogfer01 created this revision.Mar 7 2022, 6:21 AM
rogfer01 requested review of this revision.Mar 7 2022, 6:21 AM

Ok, regarding the testing in sink-splat-operands-commute.ll I took the relevant operations in sink-splat-operands.ll and swapped the input so the broadcast operand is the first one. They generate the same input (the only difference is the basic block IDs).

If we feel this is too much I can integrate that in sink-splat-operands.ll.

llvm/test/CodeGen/RISCV/rvv/sink-splat-operands.ll
3037

This is an interesting case!

By doing this we are increasing the number of vsetvlis in the loop from 2 to 3. However we could hoist the first one outside the loop because the state of vl and vtype right before the latch (bnez) is exactly the same.

I guess we can fix this in a specific change in RISCVInsertVSETVLI.cpp

craig.topper added inline comments.Mar 7 2022, 10:11 AM
llvm/test/CodeGen/RISCV/rvv/sink-splat-operands.ll
3028

Drop the FIXME?

3037

It's got a regular load mixed with a vp.add. Wouldn't we usually have a vp.load?