LLVM 22.0.0git
|
An object wrapping several components of a basic block hash. More...
#include "llvm/CodeGen/MachineBlockHashInfo.h"
Public Member Functions | |
BlendedBlockHash (uint16_t Offset, uint16_t OpcodeHash, uint16_t InstrHash, uint16_t NeighborHash) | |
BlendedBlockHash (uint64_t CombinedHash) | |
uint64_t | combine () const |
Combine the blended hash into uint64_t. | |
uint64_t | distance (const BlendedBlockHash &BBH) const |
Compute a distance between two given blended hashes. |
An object wrapping several components of a basic block hash.
The combined (blended) hash is represented and stored as one uint64_t, while individual components are of smaller size (e.g., uint16_t or uint8_t).
Definition at line 23 of file MachineBlockHashInfo.h.
|
inlineexplicit |
Definition at line 25 of file MachineBlockHashInfo.h.
Referenced by distance().
|
inlineexplicit |
Definition at line 30 of file MachineBlockHashInfo.h.
|
inline |
Combine the blended hash into uint64_t.
Definition at line 41 of file MachineBlockHashInfo.h.
Referenced by llvm::MachineBlockHashInfo::runOnMachineFunction().
|
inline |
Compute a distance between two given blended hashes.
The smaller the distance, the more similar two blocks are. For identical basic blocks, the distance is zero. Since OpcodeHash is highly stable, we consider a match good only if the OpcodeHashes are identical. Mismatched OpcodeHashes lead to low matching accuracy, and poor matches undermine the quality of final inference. Notably, during inference, we also consider the matching ratio of basic blocks. For MachineFunctions with a low matching ratio, we directly skip optimization to reduce the impact of mismatches. This ensures even very poor profiles won’t cause negative optimization. In the context of matching, we consider NeighborHash to be more important. This is especially true when accounting for inlining scenarios, where the position of a basic block in the control flow graph is more critical.
Definition at line 68 of file MachineBlockHashInfo.h.
References assert(), and BlendedBlockHash().