[llvm-commits] [llvm] r135742 - in /llvm/trunk: include/llvm/Analysis/BlockFrequency.h include/llvm/Analysis/BlockFrequencyImpl.h include/llvm/CodeGen/MachineBlockFrequency.h lib/Analysis/BlockFrequency.cpp lib/CodeGen/MachineBlockFrequency.cpp

Jakub Staszak jstaszak at apple.com
Thu Jul 21 19:24:57 PDT 2011


Author: kuba
Date: Thu Jul 21 21:24:57 2011
New Revision: 135742

URL: http://llvm.org/viewvc/llvm-project?rev=135742&view=rev
Log:
Allow getBlockFreq to return 0.

Modified:
    llvm/trunk/include/llvm/Analysis/BlockFrequency.h
    llvm/trunk/include/llvm/Analysis/BlockFrequencyImpl.h
    llvm/trunk/include/llvm/CodeGen/MachineBlockFrequency.h
    llvm/trunk/lib/Analysis/BlockFrequency.cpp
    llvm/trunk/lib/CodeGen/MachineBlockFrequency.cpp

Modified: llvm/trunk/include/llvm/Analysis/BlockFrequency.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/BlockFrequency.h?rev=135742&r1=135741&r2=135742&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/BlockFrequency.h (original)
+++ llvm/trunk/include/llvm/Analysis/BlockFrequency.h Thu Jul 21 21:24:57 2011
@@ -40,11 +40,11 @@
 
   bool runOnFunction(Function &F);
 
-  /// getblockFreq - Return block frequency. Never return 0, value must be
-  /// positive. Please note that initial frequency is equal to 1024. It means
+  /// getblockFreq - Return block frequency. Return 0 if we don't have the
+  /// information. Please note that initial frequency is equal to 1024. It means
   /// that we should not rely on the value itself, but only on the comparison to
-  /// the other block frequencies. We do this to avoid using of the floating
-  /// points.
+  /// the other block frequencies. We do this to avoid using of floating points.
+  ///
   uint32_t getBlockFreq(BasicBlock *BB);
 };
 

Modified: llvm/trunk/include/llvm/Analysis/BlockFrequencyImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/BlockFrequencyImpl.h?rev=135742&r1=135741&r2=135742&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/BlockFrequencyImpl.h (original)
+++ llvm/trunk/include/llvm/Analysis/BlockFrequencyImpl.h Thu Jul 21 21:24:57 2011
@@ -314,13 +314,12 @@
   }
 
 public:
-  /// getBlockFreq - Return block frequency. Never return 0, value must be
-  /// positive.
+  /// getBlockFreq - Return block frequency. Return 0 if we don't have it.
   uint32_t getBlockFreq(BlockT *BB) const {
     typename DenseMap<BlockT *, uint32_t>::const_iterator I = Freqs.find(BB);
     if (I != Freqs.end())
-      return I->second ? I->second : 1;
-    return 1;
+      return I->second;
+    return 0;
   }
 
   void print(raw_ostream &OS) const {

Modified: llvm/trunk/include/llvm/CodeGen/MachineBlockFrequency.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineBlockFrequency.h?rev=135742&r1=135741&r2=135742&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineBlockFrequency.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineBlockFrequency.h Thu Jul 21 21:24:57 2011
@@ -40,11 +40,11 @@
 
   bool runOnMachineFunction(MachineFunction &F);
 
-  /// getblockFreq - Return block frequency. Never return 0, value must be
-  /// positive. Please note that initial frequency is equal to 1024. It means
+  /// getblockFreq - Return block frequency. Return 0 if we don't have the
+  /// information. Please note that initial frequency is equal to 1024. It means
   /// that we should not rely on the value itself, but only on the comparison to
-  /// the other block frequencies. We do this to avoid using of the floating
-  /// points.
+  /// the other block frequencies. We do this to avoid using of floating points.
+  ///
   uint32_t getBlockFreq(MachineBasicBlock *MBB);
 };
 

Modified: llvm/trunk/lib/Analysis/BlockFrequency.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BlockFrequency.cpp?rev=135742&r1=135741&r2=135742&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/BlockFrequency.cpp (original)
+++ llvm/trunk/lib/Analysis/BlockFrequency.cpp Thu Jul 21 21:24:57 2011
@@ -49,10 +49,10 @@
   return false;
 }
 
-/// getblockFreq - Return block frequency. Never return 0, value must be
-/// positive. Please note that initial frequency is equal to 1024. It means that
-/// we should not rely on the value itself, but only on the comparison to the
-/// other block frequencies. We do this to avoid using of floating points.
+/// getblockFreq - Return block frequency. Return 0 if we don't have the
+/// information. Please note that initial frequency is equal to 1024. It means
+/// that we should not rely on the value itself, but only on the comparison to
+/// the other block frequencies. We do this to avoid using of floating points.
 ///
 uint32_t BlockFrequency::getBlockFreq(BasicBlock *BB) {
   return BFI->getBlockFreq(BB);

Modified: llvm/trunk/lib/CodeGen/MachineBlockFrequency.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBlockFrequency.cpp?rev=135742&r1=135741&r2=135742&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineBlockFrequency.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineBlockFrequency.cpp Thu Jul 21 21:24:57 2011
@@ -50,10 +50,10 @@
   return false;
 }
 
-/// getblockFreq - Return block frequency. Never return 0, value must be
-/// positive. Please note that initial frequency is equal to 1024. It means that
-/// we should not rely on the value itself, but only on the comparison to the
-/// other block frequencies. We do this to avoid using of floating points.
+/// getblockFreq - Return block frequency. Return 0 if we don't have the
+/// information. Please note that initial frequency is equal to 1024. It means
+/// that we should not rely on the value itself, but only on the comparison to
+/// the other block frequencies. We do this to avoid using of floating points.
 ///
 uint32_t MachineBlockFrequency::getBlockFreq(MachineBasicBlock *MBB) {
   return MBFI->getBlockFreq(MBB);





More information about the llvm-commits mailing list