This is an archive of the discontinued LLVM Phabricator instance.

[SelectionDAGBuilder] Remove LegalTypes=false from a call to getShiftAmountConstant.
ClosedPublic

Authored by craig.topper on Feb 18 2022, 2:48 PM.

Details

Summary

getShiftAmountTy will return MVT::i32 if the shift amount
coming from the target's getScalarShiftAmountTy can't reprsent
all possible values. That should eliminate the need to use the
pointer type which is what we do when LegalTypes is false.

Diff Detail

Event Timeline

craig.topper created this revision.Feb 18 2022, 2:48 PM
craig.topper requested review of this revision.Feb 18 2022, 2:48 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 18 2022, 2:48 PM
Herald added a subscriber: wdng. · View Herald Transcript
arsenm accepted this revision.Feb 18 2022, 2:57 PM

I don't really know why this parameter exists in the first place

This revision is now accepted and ready to land.Feb 18 2022, 2:57 PM

I don't really know why this parameter exists in the first place

I'm strongly considering removing it. getShiftAmountTy used to be broken and could return small types if LegalTypes was true. Some places in LegalizeTypes and SelectionDAGBuilder were working around this and picking MVT::i32 if it wouldn't fit. I pulled that logic into getShiftAmountTy last year. I think using pointer type when types aren't legal was also a workaround for this issue that was used by DAGCombiner originally and got sucked into getShiftAmountTy a few years ago. Maybe we can kill that off and use the MVT::i32 behavior.

This revision was landed with ongoing or failed builds.Feb 18 2022, 3:36 PM
This revision was automatically updated to reflect the committed changes.