This is an archive of the discontinued LLVM Phabricator instance.

[DAGCombiner] Use computeKnownBits to match rotate patterns that have had their amount masking modified by simplifyDemandedBits.
ClosedPublic

Authored by craig.topper on May 19 2018, 8:07 PM.

Details

Summary

SimplifyDemandedBits can remove bits from the masks for the shift amounts we need to see to detect rotates.

This patch uses zeroes from computeKnownBits to fill in some of these mask bits to make the match work.

As currently written this calls computeKnownBits even when the mask hasn't been simplified because it made the code simpler. If we're worried about compile time performance we can improve this.

I know we're talking about making a rotate intrinsic, but hopefully we can go ahead and do this change and just make sure the rotate intrinsic also handles it.

Diff Detail

Event Timeline

craig.topper created this revision.May 19 2018, 8:07 PM

Add some similar vector tests to combine-rotates.ll ?

Add vector tests too.

RKSimon accepted this revision.May 21 2018, 1:35 PM

LGTM - I don't think the cost of computeKnownBits will be a perf drain, but we can revisit if necessary

test/CodeGen/X86/combine-rotates.ll
68 ↗(On Diff #147850)

Can you fix this please? Old CHECKS that didn't get stripped.

This revision is now accepted and ready to land.May 21 2018, 1:35 PM
This revision was automatically updated to reflect the committed changes.