OSDN Git Service

Add a comment about why we need to buffer the attribute changes.
authorSean Silva <chisophugis@gmail.com>
Sat, 28 May 2016 04:24:39 +0000 (04:24 +0000)
committerSean Silva <chisophugis@gmail.com>
Sat, 28 May 2016 04:24:39 +0000 (04:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271097 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Instrumentation/PGOInstrumentation.cpp

index a21409f..6168f9e 100644 (file)
@@ -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()