Skip to content

Commit 77e5c0a

Browse files
authored
[AArch64][GISEL] Reduce likelihood of hash collisions for mappings in RegisterBankInfo (#87033)
Fixes #85209 This patch removes the truncation from `hash_code` aka `size_t` down to `unsigned`, that currently happens on DenseMap accesses in RegisterBankInfo. This reduces the likelihood of hash collisions, as well as the likelihood of hitting EmptyKey or TombstoneKey, the special key values of DenseMap. This is not the ultimate solution to the problem, but we can do it in any case.
1 parent 2d14ea6 commit 77e5c0a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/include/llvm/CodeGen/RegisterBankInfo.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -399,22 +399,22 @@ class RegisterBankInfo {
399399

400400
/// Keep dynamically allocated PartialMapping in a separate map.
401401
/// This shouldn't be needed when everything gets TableGen'ed.
402-
mutable DenseMap<unsigned, std::unique_ptr<const PartialMapping>>
402+
mutable DenseMap<hash_code, std::unique_ptr<const PartialMapping>>
403403
MapOfPartialMappings;
404404

405405
/// Keep dynamically allocated ValueMapping in a separate map.
406406
/// This shouldn't be needed when everything gets TableGen'ed.
407-
mutable DenseMap<unsigned, std::unique_ptr<const ValueMapping>>
407+
mutable DenseMap<hash_code, std::unique_ptr<const ValueMapping>>
408408
MapOfValueMappings;
409409

410410
/// Keep dynamically allocated array of ValueMapping in a separate map.
411411
/// This shouldn't be needed when everything gets TableGen'ed.
412-
mutable DenseMap<unsigned, std::unique_ptr<ValueMapping[]>>
412+
mutable DenseMap<hash_code, std::unique_ptr<ValueMapping[]>>
413413
MapOfOperandsMappings;
414414

415415
/// Keep dynamically allocated InstructionMapping in a separate map.
416416
/// This shouldn't be needed when everything gets TableGen'ed.
417-
mutable DenseMap<unsigned, std::unique_ptr<const InstructionMapping>>
417+
mutable DenseMap<hash_code, std::unique_ptr<const InstructionMapping>>
418418
MapOfInstructionMappings;
419419

420420
/// Getting the minimal register class of a physreg is expensive.

0 commit comments

Comments
 (0)