This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine][x86] try harder to convert blendv intrinsic to generic IR (PR38814)
ClosedPublic

Authored by spatel on Sep 13 2018, 1:43 PM.

Details

Summary

Missing optimizations with blendv are shown in:
https://bugs.llvm.org/show_bug.cgi?id=38814

If this works, it's an easier and more powerful solution than adding pattern matching for a few special cases in the backend. The potential danger with this transform in IR is that the condition value can get separated from the select, and the backend might not be able to make a blendv out of it again. I don't think that's too likely, but I've kept this patch minimal with a 'TODO', so we can test that theory in the wild before expanding the transform.

Diff Detail

Repository
rL LLVM

Event Timeline

spatel created this revision.Sep 13 2018, 1:43 PM
spatel updated this revision to Diff 165495.Sep 14 2018, 6:54 AM

Patch updated:
No code changes, but added tests based on the ugly bitcasted reality when using SSE intrinsics in C code. The motivating tests from PR38814 also include loads, compares, and constant operands in case we want to restrict this transform by including any of those elements in the pattern matching.

RKSimon accepted this revision.Sep 15 2018, 4:40 AM

LGTM

This revision is now accepted and ready to land.Sep 15 2018, 4:40 AM
This revision was automatically updated to reflect the committed changes.