This is an archive of the discontinued LLVM Phabricator instance.

[x86] commute blendvb with constant condition op to allow load folding
ClosedPublic

Authored by spatel on Oct 25 2018, 3:53 PM.

Details

Summary

This is a narrow fix for 1 of the problems mentioned in PR27780:
https://bugs.llvm.org/show_bug.cgi?id=27780

I looked at more general solutions, but it's a mess. We canonicalize shuffle masks based on the number of elements accessed from each operand, and that's not optional. If you remove that, we'll crash because we fail to match isel patterns. So I'm waiting until we're sure that we have blendvb with constant condition and then commuting based on the load potential.

I didn't use "MayFoldLoad" because that checks for one-use and in these cases, we've screwed that up by creating a temporary PSHUFB using these operands that we're counting on to be killed later. Undoing that didn't look like a simple task because it's intertwined with determining if we actually use both operands of the shuffle or not.

Diff Detail

Repository
rL LLVM

Event Timeline

spatel created this revision.Oct 25 2018, 3:53 PM
RKSimon accepted this revision.Oct 26 2018, 2:52 AM

LGTM

This revision is now accepted and ready to land.Oct 26 2018, 2:52 AM
This revision was automatically updated to reflect the committed changes.