This is an archive of the discontinued LLVM Phabricator instance.

[X86] Teach getUndefRegClearance that we use undef for inputs to PUNPCK in some cases.
ClosedPublic

Authored by craig.topper on May 8 2020, 12:08 AM.

Details

Summary

This enables the register to be changed from XMM/YMM/ZMM0 to
instead match the other source. This prevents a false
dependency.

I added all the integer unpck instructions, but the tests
only show changes for BW and WD.

Unfortunately, we can have undef on operand 1 or 2 of the AVX
instructions. This breaks the interface with hasUndefRegUpdate
which used to tell which operand to check.

Now we scan the input operands looking for an undef register and
then ask hasUndefRegUpdate if its an instruction we care about
and which operands of that instruction we care about.

I also had to make some changes to the load folding code to
always pass operand 1 to hasUndefRegUpdate. I've updated
hasUndefRegUpdate to return false when ForLoadFold is set for
instructions that are not explicitly blocked for load folding in
isel patterns.

Diff Detail

Event Timeline

craig.topper created this revision.May 8 2020, 12:08 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 8 2020, 12:09 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
RKSimon accepted this revision.May 9 2020, 11:09 AM

LGTM - just a query about non-VEX PACKSS/PACKUS cases

llvm/lib/Target/X86/X86InstrInfo.cpp
4895

Does the non-VEX PACKSS/PACKUS need pulling out as well since Op1 is tied? I don't know if we have examples of this though.

This revision is now accepted and ready to land.May 9 2020, 11:09 AM
craig.topper marked an inline comment as done.May 9 2020, 11:25 AM
craig.topper added inline comments.
llvm/lib/Target/X86/X86InstrInfo.cpp
4895

Yeah good catch. I'll more those.

This revision was automatically updated to reflect the committed changes.