[llvm] r271097 - Add a comment about why we need to buffer the attribute changes.

Sean Silva via llvm-commits llvm-commits at lists.llvm.org
Fri May 27 21:24:39 PDT 2016


Author: silvas
Date: Fri May 27 23:24:39 2016
New Revision: 271097

URL: http://llvm.org/viewvc/llvm-project?rev=271097&view=rev
Log:
Add a comment about why we need to buffer the attribute changes.

Modified:
    llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp

Modified: llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp?rev=271097&r1=271096&r2=271097&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp Fri May 27 23:24:39 2016
@@ -901,6 +901,9 @@ static bool annotateAllFunctions(
   }
   M.setProfileSummary(Builder.getSummary()->getMD(M.getContext()));
   // Set function hotness attribute from the profile.
+  // We have to apply these attributes at the end because their presence
+  // can affect the BranchProbabilityInfo of any callers, resulting in an
+  // inconsistent MST between prof-gen and prof-use.
   for (auto &F : HotFunctions) {
     F->addFnAttr(llvm::Attribute::InlineHint);
     DEBUG(dbgs() << "Set inline attribute to function: " << F->getName()




More information about the llvm-commits mailing list