[PATCH] D148606: Add assert to avoid unexpected situation

Wang, Xin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 18 00:24:10 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rGe4dd1d033063: Add assert to avoid unexpected situation (authored by XinWang10).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148606

Files:
  llvm/include/llvm/CodeGen/MachineBlockFrequencyInfo.h


Index: llvm/include/llvm/CodeGen/MachineBlockFrequencyInfo.h
===================================================================
--- llvm/include/llvm/CodeGen/MachineBlockFrequencyInfo.h
+++ llvm/include/llvm/CodeGen/MachineBlockFrequencyInfo.h
@@ -66,6 +66,7 @@
   /// Compute the frequency of the block, relative to the entry block.
   /// This API assumes getEntryFreq() is non-zero.
   float getBlockFreqRelativeToEntryBlock(const MachineBasicBlock *MBB) const {
+    assert(getEntryFreq() != 0 && "getEntryFreq() should not return 0 here!");
     return getBlockFreq(MBB).getFrequency() * (1.0f / getEntryFreq());
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148606.514538.patch
Type: text/x-patch
Size: 626 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230418/383ecacd/attachment.bin>


More information about the llvm-commits mailing list