From f5969f7e9c77b7d7c2ab5197f896df59d4ece07c Mon Sep 17 00:00:00 2001 From: Xinliang David Li Date: Tue, 20 Sep 2016 20:20:01 +0000 Subject: [PATCH] [Profile] Do not annotate select insts not covered in profile. 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Transforms/Instrumentation/PGOInstrumentation.cpp b/lib/Transforms/Instrumentation/PGOInstrumentation.cpp index bff155c1d67..4f333d61810 100644 --- a/lib/Transforms/Instrumentation/PGOInstrumentation.cpp +++ b/lib/Transforms/Instrumentation/PGOInstrumentation.cpp @@ -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) { -- 2.50.1