Remove code to saturate profile counts.
authorBob Wilson <bob.wilson@apple.com>
Mon, 29 Oct 2012 17:27:39 +0000 (17:27 +0000)
committerBob Wilson <bob.wilson@apple.com>
Mon, 29 Oct 2012 17:27:39 +0000 (17:27 +0000)
We may need to change the way profile counter values are stored, but
saturation is the wrong thing to do.  Just remove it for now.

Patch by Alastair Murray!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166938 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/ProfileDataLoader.h
lib/Analysis/ProfileDataLoader.cpp

index bec9fac770c70570f242aee17e8358139fe84311..9efbafcef41c45fd3ca0f321cbb648e586698ae7 100644 (file)
@@ -115,9 +115,6 @@ public:
   /// been counted yet.
   static const unsigned Uncounted;
 
-  /// The maximum value that can be stored in a profiling counter.
-  static const unsigned MaxCount;
-
   /// getNumExecutions - Return the number of times the target program was run
   /// to generate this profiling data.
   unsigned getNumExecutions() const { return CommandLines.size(); }
index 69286efb3c5de64a63038eb92b85dc617062029f..a4f634af531e946292314521ad154a1770b7cf3e 100644 (file)
@@ -51,13 +51,7 @@ static unsigned AddCounts(unsigned A, unsigned B) {
   if (A == ProfileDataLoader::Uncounted) return B;
   if (B == ProfileDataLoader::Uncounted) return A;
 
-  // Saturate to the maximum storable value.  This could change taken/nottaken
-  // ratios, but is presumably better than wrapping and thus potentially
-  // inverting ratios.
-  uint64_t tmp = (uint64_t)A + (uint64_t)B;
-  if (tmp > (uint64_t)ProfileDataLoader::MaxCount)
-    tmp = ProfileDataLoader::MaxCount;
-  return (unsigned)tmp;
+  return A + B;
 }
 
 /// ReadProfilingData - Load 'NumEntries' items of type 'T' from file 'F'
@@ -120,7 +114,6 @@ static void ReadProfilingArgBlock(const char *ToolName, FILE *F,
 }
 
 const unsigned ProfileDataLoader::Uncounted = ~0U;
-const unsigned ProfileDataLoader::MaxCount = ~0U - 1U;
 
 /// ProfileDataLoader ctor - Read the specified profiling data file, reporting
 /// a fatal error if the file is invalid or broken.