Page MenuHomePhabricator

[DAGCombiner] Add another combine from build vector to shuffle

Authored by guyblank on Jun 7 2017, 8:24 AM.



The patch adds support for combining a build vector to a shuffle.
When the build vector is of extracted elements from 2 vectors (vec1, vec2) where vec2 is 2 times smaller than vec1. Without the patch this would generate a bunch of extract/insert.

Not sure if the changed AArch64 test got better or worse though...

Diff Detail

Event Timeline

guyblank created this revision.Jun 7 2017, 8:24 AM
RKSimon edited reviewers, added: efriedma; removed: eli.friedman.Jun 7 2017, 9:48 AM
RKSimon added inline comments.Jun 7 2017, 9:52 AM

Why do you have all this extra code (zext/mul/lshr/trunc)? Isn't the problem just in the shufflevector?

dorit added a subscriber: dorit.Jun 8 2017, 1:12 AM
delena added a subscriber: delena.Jun 12 2017, 1:32 AM
delena added inline comments.

In the case above you'll find (VT.getSizeInBits() % InVT1.getSizeInBits() == 0). Is this your case
(VT.getSizeInBits() % InVT2.getSizeInBits() == 0) ?

guyblank added inline comments.Jun 14 2017, 12:17 AM

The case in line 13962 also checks that InVT1 == InVT2.

if ((VT.getSizeInBits() % InVT1.getSizeInBits() == 0) && InVT1 == InVT2)

It then concats InVT1,InVT2 and a bunch of undef vectors to reach the size of VT.
The shuffle will be on the result of the concats and an undef vector of the same size.

In the case i've added, InVT2 is smaller than InVT1. So it is concated with undef to reach the size of InVT1 and VT.
The shuffle will be on InVT1 and the result of the concat.


specifically in this case it causes the build vector result to be v32i8, and be caught by the if i've added.
but i should probably change the shufflevector to just return <32 x i8>, since it would demonstrate the issue as well, without the extra code.


guyblank updated this revision to Diff 103014.Jun 19 2017, 4:34 AM

rebased after updating the test case

delena accepted this revision.Jun 20 2017, 11:15 PM
This revision is now accepted and ready to land.Jun 20 2017, 11:15 PM
guyblank closed this revision.Jun 21 2017, 7:16 AM

Closed by commit rL305883: [DAGCombiner] Add another combine from build vector to shuffle