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

Mircea Trofin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 22 15:47:01 PDT 2020


mtrofin 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();
----------------
yamauchi wrote:
> 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.)
> 
Done - I suppose if a user wants to calculate double precision, they may still do so.


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