This is an archive of the discontinued LLVM Phabricator instance.

[ADT] fix PackedVector crash for long bits
Needs ReviewPublic

Authored by tuoxie007 on Nov 8 2020, 6:59 PM.

Details

Reviewers
akyrtzi
Summary

I noticed that the class PackedVector doesn't work like what it's name says. e.g.

PackedVector<signed, 4> vec(2);

will use 16 bits.

PackedVector<signed, 8> vec(2);

will use 256 bits.

Event when I created a longer bits vector, e.g.

PackedVector<signed, 30> Vec2(8);

There would be a out of index error. Beacause the size which is an unsigned type calculated with 8<<(30-1) is 0.

Diff Detail

Event Timeline

tuoxie007 created this revision.Nov 8 2020, 6:59 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 8 2020, 6:59 PM
tuoxie007 requested review of this revision.Nov 8 2020, 6:59 PM
tuoxie007 edited the summary of this revision. (Show Details)Nov 8 2020, 7:14 PM
tuoxie007 added a reviewer: akyrtzi.
tuoxie007 edited the summary of this revision. (Show Details)