Skip to content

Commit

Permalink
[AArch64][GISEL] Reduce likelihood of hash collisions for mappings in…
Browse files Browse the repository at this point in the history
… RegisterBankInfo
  • Loading branch information
marcauberer committed Mar 29, 2024
1 parent 89bae85 commit febc33d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
1 change: 0 additions & 1 deletion llvm/include/llvm/ADT/DenseMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include <cstring>
#include <initializer_list>
#include <iterator>
#include <new>
#include <type_traits>
#include <utility>

Expand Down
8 changes: 4 additions & 4 deletions llvm/include/llvm/CodeGen/RegisterBankInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -399,22 +399,22 @@ class RegisterBankInfo {

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

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

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

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

/// Getting the minimal register class of a physreg is expensive.
Expand Down
5 changes: 2 additions & 3 deletions llvm/lib/CodeGen/RegisterBankInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ RegisterBankInfo::getInstrMappingImpl(const MachineInstr &MI) const {
if (!OperandsMapping[0]) {
if (MI.isRegSequence()) {
// For reg_sequence, the result size does not match the input.
unsigned ResultSize = getSizeInBits(MI.getOperand(0).getReg(),
MRI, TRI);
unsigned ResultSize =
getSizeInBits(MI.getOperand(0).getReg(), MRI, TRI);
OperandsMapping[0] = &getValueMapping(0, ResultSize, *CurRegBank);
} else {
OperandsMapping[0] = ValMapping;
Expand Down Expand Up @@ -332,7 +332,6 @@ RegisterBankInfo::getValueMapping(const PartialMapping *BreakDown,
template <typename Iterator>
const RegisterBankInfo::ValueMapping *
RegisterBankInfo::getOperandsMapping(Iterator Begin, Iterator End) const {

++NumOperandsMappingsAccessed;

// The addresses of the value mapping are unique.
Expand Down

0 comments on commit febc33d

Please sign in to comment.