This is an archive of the discontinued LLVM Phabricator instance.

[LegalizeTypes][TargetLowering] Merge getShiftAmountTyForConstant into TargetLowering::getShiftAmountTy.
ClosedPublic

Authored by craig.topper on Oct 25 2021, 10:26 AM.

Details

Summary

getShiftAmountTyForConstant is a special helper that changes the
shift amount to i32 if the type chosen by
TargetLowering::getShiftAmountTy can't represent all possible values.
This is needed to satisfy an assert in SelectionDAG::getNode.

It requires additional consideration to know when this helper should be used.
I'm not sure that we are always using it when we should.

This patch merges the getShiftAmountTyForConstant handling into
TargetLowering::getShiftAmountTy so we don't need to think about it
anymore.

Technically this may slightly increase compile times since the majority
of callers of getShiftAmountTy won't need this. Hopefully, this isn't
an issue in practice.

Diff Detail

Event Timeline

craig.topper created this revision.Oct 25 2021, 10:26 AM
craig.topper requested review of this revision.Oct 25 2021, 10:26 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 25 2021, 10:26 AM

Use MVT instead of EVT in getShiftAmountTy. Should make getSizeInBits() cheaper.

RKSimon accepted this revision.Oct 25 2021, 2:01 PM

LGTM - cheers

This revision is now accepted and ready to land.Oct 25 2021, 2:01 PM
This revision was landed with ongoing or failed builds.Oct 25 2021, 2:10 PM
This revision was automatically updated to reflect the committed changes.