[PATCH] Add -fprofile-sample-use to Clang's driver.

Diego Novillo dnovillo at google.com
Thu Oct 31 07:25:29 PDT 2013


  Thanks for the review. I want to wait until the LLVM side is ready before committing this patch.


================
Comment at: lib/CodeGen/BackendUtil.cpp:247-248
@@ +246,4 @@
+  if (!CodeGenOpts.SampleProfileFile.empty())
+    PMBuilder.addExtension(PassManagerBuilder::EP_EarlyAsPossible,
+                           addSampleProfileLoaderPass);
+
----------------
Chandler Carruth wrote:
> I wonder if EarlyAsPossible is quite right.
> 
> For example, it might be useful for LowerExpect to run first in order for the branch weights from __builtin_expect to be visible when reading the profile. Thoughts? (Clearly not a blocker for this patch, just something to think about.)
What to do with __builtin_expect is still open to interpretation.  I'm leaning towards overriding it, but we may want to give a warning or decide that static annotations always override dynamic behaviour (I'm not sure I want that, however).

How would I make the profiler run after LowerExpect?


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



More information about the cfe-commits mailing list