[BlockFrequency] Add operator<< overload (#181703)

This makes it more convenient to debug BFI issues.
This commit is contained in:
Nikita Popov 2026-02-17 15:34:53 +01:00 committed by GitHub
parent f560e4cfb1
commit 9991a5fb45
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 0 deletions

View File

@ -121,6 +121,8 @@ public:
}
};
LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, BlockFrequency Freq);
LLVM_ABI void printRelativeBlockFreq(raw_ostream &OS, BlockFrequency EntryFreq,
BlockFrequency Freq);

View File

@ -48,6 +48,11 @@ std::optional<BlockFrequency> BlockFrequency::mul(uint64_t Factor) const {
return BlockFrequency(ResultFrequency);
}
raw_ostream &llvm::operator<<(raw_ostream &OS, BlockFrequency Freq) {
OS << Freq.getFrequency();
return OS;
}
void llvm::printRelativeBlockFreq(raw_ostream &OS, BlockFrequency EntryFreq,
BlockFrequency Freq) {
if (Freq == BlockFrequency(0)) {