This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] narrow vector select with padded condition and extracted result (PR38691)
ClosedPublic

Authored by spatel on Aug 30 2018, 10:16 AM.

Details

Summary

shuf (sel (shuf NarrowCond, undef, WideMask), X, Y), undef, NarrowMask) -->
sel NarrowCond, (shuf X, undef, NarrowMask), (shuf Y, undef, NarrowMask)

The motivating case from:
https://bugs.llvm.org/show_bug.cgi?id=38691
...is the last regression test. In that case, we're just left with the narrow select.

Note that if we do create new shuffles, they use the existing extraction identity mask, so there's no danger that this transform creates arbitrary shuffles.

This patch is based on trunk, so it doesn't include the potential improvement from the demanded elements change in D51433. If that is reviewed/committed, I can rebase this.

Diff Detail

Repository
rL LLVM

Event Timeline

spatel created this revision.Aug 30 2018, 10:16 AM

Looks good, but i would prefer for someone else to take a look, too.

test/Transforms/InstCombine/shuffle-select-narrow.ll
82 ↗(On Diff #163352)

Would be best to move this to right after %widecmp =

lebedev.ri accepted this revision.Sep 7 2018, 10:23 AM

Looks good, but i would prefer for someone else to take a look, too.

This revision is now accepted and ready to land.Sep 7 2018, 10:23 AM
RKSimon accepted this revision.Sep 7 2018, 10:42 AM

LGTM

This revision was automatically updated to reflect the committed changes.
spatel marked an inline comment as done.