[PATCH] Refactor classes in sample profiler for new functionality

Chandler Carruth chandlerc at gmail.com
Tue Nov 26 11:51:29 PST 2013


  Patch looks fine to commit. I have a question below about code I don't understand, but it's not new in this patch I just didn't notice it before.

  I do wonder, would s/Global/Module/g be more clear in an LLVM context?


================
Comment at: lib/Transforms/Scalar/SampleProfile.cpp:332-333
@@ -310,9 +331,4 @@
     Loader.reportParseError("Expected a number, found " + Line);
-  for (int I = 0; I < NumSymbols; I++) {
-    StringRef FName = Loader.readLine();
-    FunctionProfile &FProfile = Profiles[FName];
-    FProfile.BodySamples.clear();
-    FProfile.TotalSamples = 0;
-    FProfile.TotalHeadSamples = 0;
-  }
+  for (int I = 0; I < NumSymbols; I++)
+    Profiles[Loader.readLine()] = SampleFunctionProfile();
 
----------------
I think this is dead code? When you use [] on the map below, it will default construct a SampleFunctionProfile entry when one isn't already in the map.


http://llvm-reviews.chandlerc.com/D2223



More information about the llvm-commits mailing list