This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine][NFC] dropRedundantMaskingOfLeftShiftInput(): change how we deal with mask
ClosedPublic

Authored by lebedev.ri on Oct 4 2019, 9:11 AM.

Details

Summary

Currently, we pre-check whether we need to produce a mask or not.
This involves some rather magical constants.
I'd like to extend this fold to also handle the situation
when there's also a trunc before outer shift.
That will require another set of magical constants.
It's ugly.

Instead, we can just compute the mask, and check
whether mask is a pass-through (all-ones) or not.
This way we don't need to have any magical numbers.

This change is NFC other than the fact that we now compute
the mask and then check if we need (and can!) apply it.

Diff Detail

Repository
rL LLVM

Event Timeline

lebedev.ri created this revision.Oct 4 2019, 9:11 AM
lebedev.ri updated this revision to Diff 223332.Oct 4 2019, 4:02 PM

Rebased, NFC.

spatel added a comment.Oct 7 2019, 5:14 AM

The diff as shown includes D68239 rather than building on top of it? Commit the other patch and rebase, so we are current with trunk?

The diff as shown includes D68239 rather than building on top of it? Commit the other patch and rebase, so we are current with trunk?

No, this is fully properly rebased.

spatel accepted this revision.Oct 7 2019, 6:46 AM

The diff as shown includes D68239 rather than building on top of it? Commit the other patch and rebase, so we are current with trunk?

No, this is fully properly rebased.

I see. I was distracted by the cosmetic diffs caused by different indentation. This is already NFC, so there's not much point in making sub-patches. LGTM.

This revision is now accepted and ready to land.Oct 7 2019, 6:46 AM

The diff as shown includes D68239 rather than building on top of it? Commit the other patch and rebase, so we are current with trunk?

No, this is fully properly rebased.

I see. I was distracted by the cosmetic diffs caused by different indentation. This is already NFC, so there's not much point in making sub-patches. LGTM.

Thank you for the review!

This revision was automatically updated to reflect the committed changes.