mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-16 12:24:03 +00:00
The patchpoint lowering logic would crash with live constants equal to
the tombstone or empty keys of a DenseMap<int64_t, T>. This patch fixes the issue (and adds a tests case). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221214 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -222,6 +222,16 @@ void StackMaps::recordStackMapOpers(const MachineInstr &MI, uint64_t ID,
|
||||
// -1 is directly encoded as .long 0xFFFFFFFF with no constant pool.
|
||||
if (I->LocType == Location::Constant && !isInt<32>(I->Offset)) {
|
||||
I->LocType = Location::ConstantIndex;
|
||||
// ConstPool is intentionally a MapVector of 'uint64_t's (as
|
||||
// opposed to 'int64_t's). We should never be in a situation
|
||||
// where we have to insert either the tombstone or the empty
|
||||
// keys into a map, and for a DenseMap<uint64_t, T> these are
|
||||
// (uint64_t)0 and (uint64_t)-1. They can be and are
|
||||
// represented using 32 bit integers.
|
||||
|
||||
assert((uint64_t)I->Offset != DenseMapInfo<uint64_t>::getEmptyKey() &&
|
||||
(uint64_t)I->Offset != DenseMapInfo<uint64_t>::getTombstoneKey() &&
|
||||
"empty and tombstone keys should fit in 32 bits!");
|
||||
auto Result = ConstPool.insert(std::make_pair(I->Offset, I->Offset));
|
||||
I->Offset = Result.first - ConstPool.begin();
|
||||
}
|
||||
|
Reference in New Issue
Block a user