This is an archive of the discontinued LLVM Phabricator instance.

[SelectionDAG] Fix off by one error in range check in DAGTypeLegalizer::ExpandShiftByConstant.
ClosedPublic

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

Details

Summary

The code was considering shifts by an about larger than the number of
bits in the original VT to be out of range. Shifts exactly equal to
the original bit width are also out of range.

I don't know how to test this. DAGCombiner should usually fold this
away. I just noticed while looking for something else in this code. The
llvm-cov report shows that we don't have coverage for out of range shifts here.

Diff Detail

Event Timeline

craig.topper created this revision.Feb 18 2022, 4:48 PM
craig.topper requested review of this revision.Feb 18 2022, 4:48 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 18 2022, 4:48 PM
Herald added a subscriber: wdng. · View Herald Transcript
craig.topper edited the summary of this revision. (Show Details)Feb 18 2022, 4:50 PM
arsenm accepted this revision.Feb 18 2022, 4:58 PM
This revision is now accepted and ready to land.Feb 18 2022, 4:58 PM
This revision was landed with ongoing or failed builds.Feb 18 2022, 6:43 PM
This revision was automatically updated to reflect the committed changes.