]> granicus.if.org Git - llvm/commitdiff
[Profile] Do not annotate select insts not covered in profile.
authorXinliang David Li <davidxl@google.com>
Tue, 20 Sep 2016 20:20:01 +0000 (20:20 +0000)
committerXinliang David Li <davidxl@google.com>
Tue, 20 Sep 2016 20:20:01 +0000 (20:20 +0000)
Fixed PR/30466

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282009 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Instrumentation/PGOInstrumentation.cpp

index bff155c1d67e273955227030a1b3d5b59ded9b2e..4f333d6181039227ecedd5fb1f3dc3f0c671d72b 100644 (file)
@@ -967,7 +967,8 @@ void SelectInstVisitor::annotateOneSelectInst(SelectInst &SI) {
   // 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) {