[PATCH] D84357: [llvm][NFC] Add comments and common-case API to MachineBlockFrequencyInfo

Hiroshi Yamauchi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 22 15:32:42 PDT 2020


yamauchi added inline comments.


================
Comment at: llvm/include/llvm/CodeGen/MachineBlockFrequencyInfo.h:68
+  /// This API assumes getEntryFreq() is non-zero.
+  double getBlockFreqRelativeToEntrypoint(const MachineBasicBlock *MBB) const {
+    return getBlockFreq(MBB).getFrequency() * 1.0 / getEntryFreq();
----------------
I'd go with "Entry" (or "EntryBlock") rather than "Entrypoint" here (and also in the new comments), as I don't think the latter is used around here.

Also, I'd use float instead of double and add parentheses around the division (so the "1.0 / ..." part 
 happens before the multiplication) to preserve the original spill cost formula below exactly. Slight errors might matter (might not but to be safe.)



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84357/new/

https://reviews.llvm.org/D84357





More information about the llvm-commits mailing list