This is an archive of the discontinued LLVM Phabricator instance.

[X86] Add an override of targetShrinkDemandedConstant to limit the damage that shrinkdemandedbits can do to zext_in_reg operations
ClosedPublic

Authored by craig.topper on Jan 18 2018, 3:10 PM.

Details

Summary

This patch adds an implementation of targetShrinkDemandedConstant that tries to keep shrinkdemandedbits from removing bits that would otherwise have been recognized as a movzx.

We still need a follow patch to stop moving ands across srl if the and could be represented as a movzx before the shift but not after. I think this should help with some of the cases that D42088 ended up removing during isel.

Diff Detail

Event Timeline

craig.topper created this revision.Jan 18 2018, 3:10 PM

Seems like a good change. I was afraid of getting regressions from something like this, but the loosening of the tablegen matcher seems to be handling those cases.

Is it possible to concoct smaller, dedicated tests that show the wins?

Rebase after adding zext-demanded.ll

spatel accepted this revision.Jan 20 2018, 8:02 AM

LGTM.

This revision is now accepted and ready to land.Jan 20 2018, 8:02 AM
This revision was automatically updated to reflect the committed changes.