mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-10 22:46:25 +00:00
UseListOrder: Correctly count the number of uses
This is an off-by-one bug I found by inspection, which would only trigger if the bitcode writer sees more uses of a `Value` than the reader. Since this is only relevant when an instruction gets upgraded somehow, there unfortunately isn't a reasonable way to add test coverage. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215804 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7a5cb43115
commit
1e97329f27
@ -1697,9 +1697,9 @@ std::error_code BitcodeReader::ParseUseLists() {
|
||||
unsigned NumUses = 0;
|
||||
SmallDenseMap<const Use *, unsigned, 16> Order;
|
||||
for (const Use &U : V->uses()) {
|
||||
if (NumUses > Record.size())
|
||||
if (++NumUses > Record.size())
|
||||
break;
|
||||
Order[&U] = Record[NumUses++];
|
||||
Order[&U] = Record[NumUses - 1];
|
||||
}
|
||||
if (Order.size() != Record.size() || NumUses > Record.size())
|
||||
// Mismatches can happen if the functions are being materialized lazily
|
||||
|
Loading…
x
Reference in New Issue
Block a user