Skip to content

Commit febc33d

Browse files
committed
[AArch64][GISEL] Reduce likelihood of hash collisions for mappings in RegisterBankInfo
1 parent 89bae85 commit febc33d

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

llvm/include/llvm/ADT/DenseMap.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#include <cstring>
2929
#include <initializer_list>
3030
#include <iterator>
31-
#include <new>
3231
#include <type_traits>
3332
#include <utility>
3433

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.

llvm/lib/CodeGen/RegisterBankInfo.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,8 @@ RegisterBankInfo::getInstrMappingImpl(const MachineInstr &MI) const {
221221
if (!OperandsMapping[0]) {
222222
if (MI.isRegSequence()) {
223223
// For reg_sequence, the result size does not match the input.
224-
unsigned ResultSize = getSizeInBits(MI.getOperand(0).getReg(),
225-
MRI, TRI);
224+
unsigned ResultSize =
225+
getSizeInBits(MI.getOperand(0).getReg(), MRI, TRI);
226226
OperandsMapping[0] = &getValueMapping(0, ResultSize, *CurRegBank);
227227
} else {
228228
OperandsMapping[0] = ValMapping;
@@ -332,7 +332,6 @@ RegisterBankInfo::getValueMapping(const PartialMapping *BreakDown,
332332
template <typename Iterator>
333333
const RegisterBankInfo::ValueMapping *
334334
RegisterBankInfo::getOperandsMapping(Iterator Begin, Iterator End) const {
335-
336335
++NumOperandsMappingsAccessed;
337336

338337
// The addresses of the value mapping are unique.

0 commit comments

Comments
 (0)