ValueEnumerator: make the index type unsigned instead of size_t

This reduces the size of the index from 8 to 4 bytes, which is important in AliasAnalysis where we use pairs of such indices.
This commit is contained in:
Erik Eckstein
2021-03-22 13:00:35 +01:00
parent 7f2c262816
commit ed7a8026d6
4 changed files with 27 additions and 24 deletions

View File

@@ -546,11 +546,11 @@ AliasAnalysis::computeMemoryBehaviorInner(SILInstruction *Inst, SILValue V) {
MemBehaviorKeyTy AliasAnalysis::toMemoryBehaviorKey(SILInstruction *V1,
SILValue V2) {
size_t idx1 = InstructionToIndex.getIndex(V1);
assert(idx1 != std::numeric_limits<size_t>::max() &&
ValueIndexTy idx1 = InstructionToIndex.getIndex(V1);
assert(idx1 != std::numeric_limits<ValueIndexTy>::max() &&
"~0 index reserved for empty/tombstone keys");
size_t idx2 = ValueToIndex.getIndex(V2);
assert(idx2 != std::numeric_limits<size_t>::max() &&
ValueIndexTy idx2 = ValueToIndex.getIndex(V2);
assert(idx2 != std::numeric_limits<ValueIndexTy>::max() &&
"~0 index reserved for empty/tombstone keys");
return {idx1, idx2};
}