[llvm] r282009 - [Profile] Do not annotate select insts not covered in profile.

Xinliang David Li via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 20 13:20:02 PDT 2016


Author: davidxl
Date: Tue Sep 20 15:20:01 2016
New Revision: 282009

URL: http://llvm.org/viewvc/llvm-project?rev=282009&view=rev
Log:
[Profile] Do not annotate select insts not covered in profile.

Fixed PR/30466



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=282009&r1=282008&r2=282009&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp Tue Sep 20 15:20:01 2016
@@ -967,7 +967,8 @@ void SelectInstVisitor::annotateOneSelec
   // False Count
   SCounts[1] = (TotalCount > SCounts[0] ? TotalCount - SCounts[0] : 0);
   uint64_t MaxCount = std::max(SCounts[0], SCounts[1]);
-  setProfMetadata(F.getParent(), &SI, SCounts, MaxCount);
+  if (MaxCount)
+    setProfMetadata(F.getParent(), &SI, SCounts, MaxCount);
 }
 
 void SelectInstVisitor::visitSelectInst(SelectInst &SI) {




More information about the llvm-commits mailing list