This is an archive of the discontinued LLVM Phabricator instance.

[x86] eliminate redundant shuffle of horizontal math ops when both inputs are the same
ClosedPublic

Authored by spatel on Aug 31 2017, 2:19 PM.

Details

Summary

This is limited to a set of patterns based on the example in PR34111:
https://bugs.llvm.org/show_bug.cgi?id=34111
...but as I was investigating this, I see that horizontal patterns can go wrong in many, many other ways that would not be handled by this patch. Each data type may even go different in the DAG after starting with the same basic IR pattern, so even proper IR canonicalization won't fix it all.

Diff Detail

Repository
rL LLVM

Event Timeline

spatel created this revision.Aug 31 2017, 2:19 PM
craig.topper added inline comments.Aug 31 2017, 11:08 PM
lib/Target/X86/X86ISelLowering.cpp
29078 ↗(On Diff #113467)

Take ArrayRef by value, its a pointer and size.

29079 ↗(On Diff #113467)

Maybe add a TODO that this is incomplete? {1, 1}, {1, 0} would also be redundant right?

spatel updated this revision to Diff 113535.Sep 1 2017, 6:24 AM
spatel marked 2 inline comments as done.

Patch updated:

  1. Take ArrayRef by value rather than ref.
  2. Add TODO about checking more shuffle masks (h-op matching doesn't currently work for the listed cases, so it probably doesn't make sense to add those unless/until we fix that).
This revision is now accepted and ready to land.Sep 1 2017, 11:09 AM
This revision was automatically updated to reflect the committed changes.