From 62d5e473ce722145f76935e04ea3f613763b2f63 Mon Sep 17 00:00:00 2001 From: Rong Xu Date: Thu, 28 Apr 2016 17:49:56 +0000 Subject: [PATCH] [PGO] Fix incorrect Twine usage in emitting optimization remarks. Should not store Twine objects to local variables. This is fixed the test failures with r267815 in VS2015 X64 build. llvm-svn: 267908 --- .../Instrumentation/IndirectCallPromotion.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp b/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp index 0416efd8996a..87df5121b20a 100644 --- a/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp +++ b/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp @@ -327,12 +327,11 @@ ICallPromotionFunc::getPromotionCandidatesForCallSite( StringRef TargetFuncName = Symtab->getFuncName(Target); const char *Reason = StatusToString(Status); DEBUG(dbgs() << " Not promote: " << Reason << "\n"); - Twine Msg = + emitOptimizationRemarkMissed( + F.getContext(), "PGOIndirectCallPromotion", F, Inst->getDebugLoc(), Twine("Cannot promote indirect call to ") + - (TargetFuncName.empty() ? Twine(Target) : Twine(TargetFuncName)) + - Twine(" with count of ") + Twine(Count) + ": " + Reason; - emitOptimizationRemarkMissed(F.getContext(), "PGOIndirectCallPromotion", - F, Inst->getDebugLoc(), Msg); + (TargetFuncName.empty() ? Twine(Target) : Twine(TargetFuncName)) + + Twine(" with count of ") + Twine(Count) + ": " + Reason); break; } Ret.push_back(PromotionCandidate(TargetFunction, Count)); @@ -603,10 +602,10 @@ void ICallPromotionFunc::promote(Instruction *Inst, Function *DirectCallee, DEBUG(dbgs() << "\n== Basic Blocks After ==\n"); DEBUG(dbgs() << *BB << *DirectCallBB << *IndirectCallBB << *MergeBB << "\n"); - Twine Msg = Twine("Promote indirect call to ") + DirectCallee->getName() + - " with count " + Twine(Count) + " out of " + Twine(TotalCount); - emitOptimizationRemark(F.getContext(), "PGOIndirectCallPromotion", F, - Inst->getDebugLoc(), Msg); + emitOptimizationRemark( + F.getContext(), "PGOIndirectCallPromotion", F, Inst->getDebugLoc(), + Twine("Promote indirect call to ") + DirectCallee->getName() + + " with count " + Twine(Count) + " out of " + Twine(TotalCount)); } // Promote indirect-call to conditional direct-call for one callsite. -- GitLab