This is an archive of the discontinued LLVM Phabricator instance.

[DAGCombiner][X86] Don't peek through ANDs on the shift amount in matchRotateSub when called from MatchFunnelPosNeg.
ClosedPublic

Authored by craig.topper on Feb 28 2021, 11:30 AM.

Details

Summary

Peeking through AND is only valid if the input to both shifts is
the same. If the inputs are different, then the original pattern
ORs the two values when the masked shift amount is 0. This is ok
if the values are the same since the OR would be a NOP which is
why its ok for rotate.

Fixes PR49365 and reverts PR34641

Diff Detail

Event Timeline

craig.topper created this revision.Feb 28 2021, 11:30 AM
craig.topper requested review of this revision.Feb 28 2021, 11:30 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 28 2021, 11:30 AM
lebedev.ri accepted this revision.Feb 28 2021, 11:44 AM
lebedev.ri added a subscriber: lebedev.ri.

Hm, i recall viewing the original patch back then, not sure why i didn't catch that :/
LGTM

llvm/test/CodeGen/X86/shift-double.ll
486–487
This revision is now accepted and ready to land.Feb 28 2021, 11:44 AM
RKSimon accepted this revision.Feb 28 2021, 12:34 PM

LGTM

llvm/test/CodeGen/X86/shift-double.ll
486–487

probably not "safe" then......

This revision was landed with ongoing or failed builds.Feb 28 2021, 1:01 PM
This revision was automatically updated to reflect the committed changes.