Page MenuHomePhabricator

[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

Unit TestsFailed

TimeTest
4,280 mswindows > Clang-Unit.DirectoryWatcher/_/DirectoryWatcherTests_exe::DirectoryWatcherTest.AddFiles
Note: Google Test filter = DirectoryWatcherTest.AddFiles [==========] Running 1 test from 1 test case.
4,050 mswindows > Clang-Unit.DirectoryWatcher/_/DirectoryWatcherTests_exe::DirectoryWatcherTest.DeleteFile
Note: Google Test filter = DirectoryWatcherTest.DeleteFile [==========] Running 1 test from 1 test case.
4,110 mswindows > Clang-Unit.DirectoryWatcher/_/DirectoryWatcherTests_exe::DirectoryWatcherTest.ModifyFile
Note: Google Test filter = DirectoryWatcherTest.ModifyFile [==========] Running 1 test from 1 test case.
300 mswindows > lld.ELF/invalid::symtab-sh-info.s
Script: -- : 'RUN: at line 4'; c:\ws\w32-1\llvm-project\premerge-checks\build\bin\yaml2obj.exe --docnum=1 C:\ws\w32-1\llvm-project\premerge-checks\lld\test\ELF\invalid\symtab-sh-info.s -o C:\ws\w32-1\llvm-project\premerge-checks\build\tools\lld\test\ELF\invalid\Output\symtab-sh-info.s.tmp.o

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.