[all-commits] [llvm/llvm-project] 2e26d0: BlockFrequencyInfo: Add PrintBlockFreq helper (#67...

Matthias Braun via All-commits all-commits at lists.llvm.org
Thu Oct 5 18:27:04 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2e26d091060e87629f23163433b5e2fd450b54bf
      https://github.com/llvm/llvm-project/commit/2e26d091060e87629f23163433b5e2fd450b54bf
  Author: Matthias Braun <matze at braunis.de>
  Date:   2023-10-05 (Thu, 05 Oct 2023)

  Changed paths:
    M llvm/include/llvm/Analysis/BlockFrequencyInfo.h
    M llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h
    M llvm/include/llvm/CodeGen/MBFIWrapper.h
    M llvm/include/llvm/CodeGen/MachineBlockFrequencyInfo.h
    M llvm/lib/Analysis/BlockFrequencyInfo.cpp
    M llvm/lib/Analysis/BlockFrequencyInfoImpl.cpp
    M llvm/lib/CodeGen/MBFIWrapper.cpp
    M llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp
    M llvm/lib/CodeGen/MachineBlockPlacement.cpp
    M llvm/lib/CodeGen/RegAllocGreedy.cpp
    M llvm/lib/CodeGen/ShrinkWrap.cpp

  Log Message:
  -----------
  BlockFrequencyInfo: Add PrintBlockFreq helper (#67512)

- Refactor the (Machine)BlockFrequencyInfo::printBlockFreq functions
into a `PrintBlockFreq()` function returning a `Printable` object. This
simplifies usage as it can be directly piped to a `raw_ostream` like
`dbgs() << PrintBlockFreq(MBFI, Freq) << '\n';`.
- Previously there was an interesting behavior where
`BlockFrequencyInfoImpl` stores frequencies both as a `Scaled64` number
and as an `uint64_t`. Most algorithms use the `BlockFrequency`
abstraction with the integers, the print function for basic blocks
printed the `Scaled64` number potentially showing higher accuracy than
was used by the algorithm. This changes things to only print
`BlockFrequency` values.
- Replace some instances of `dbgs() << Freq.getFrequency()` with the new
function.




More information about the All-commits mailing list