This is an archive of the discontinued LLVM Phabricator instance.

[GlobalISel][KnownBits] Early return on out of bound shift amounts
ClosedPublic

Authored by kschwarz on Oct 12 2020, 4:22 AM.

Details

Summary

If the known shift amount is bigger than or equal to the bitwidth of the type of the value to be shifted,
the result is target dependent, so don't try to infer any bits.

This fixes a crash we've seen in one of our internal test suites.

Diff Detail

Event Timeline

kschwarz created this revision.Oct 12 2020, 4:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 12 2020, 4:22 AM
kschwarz requested review of this revision.Oct 12 2020, 4:22 AM
arsenm added inline comments.Oct 12 2020, 7:51 AM
llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp
401

getScalarSizeInBits. This should also be >=

llvm/unittests/CodeGen/GlobalISel/KnownBitsTest.cpp
735

Also add and equal sized case

kschwarz updated this revision to Diff 297603.Oct 12 2020, 8:39 AM
kschwarz edited the summary of this revision. (Show Details)

Address review comments

arsenm accepted this revision.Oct 12 2020, 8:58 AM
This revision is now accepted and ready to land.Oct 12 2020, 8:58 AM
This revision was landed with ongoing or failed builds.Oct 12 2020, 9:39 AM
This revision was automatically updated to reflect the committed changes.