Skip to content
Snippets Groups Projects
Commit 62d5e473 authored by Rong Xu's avatar Rong Xu
Browse files

[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
parent 6a2ec9fc
No related branches found
No related tags found
No related merge requests found
...@@ -327,12 +327,11 @@ ICallPromotionFunc::getPromotionCandidatesForCallSite( ...@@ -327,12 +327,11 @@ ICallPromotionFunc::getPromotionCandidatesForCallSite(
StringRef TargetFuncName = Symtab->getFuncName(Target); StringRef TargetFuncName = Symtab->getFuncName(Target);
const char *Reason = StatusToString(Status); const char *Reason = StatusToString(Status);
DEBUG(dbgs() << " Not promote: " << Reason << "\n"); DEBUG(dbgs() << " Not promote: " << Reason << "\n");
Twine Msg = emitOptimizationRemarkMissed(
F.getContext(), "PGOIndirectCallPromotion", F, Inst->getDebugLoc(),
Twine("Cannot promote indirect call to ") + Twine("Cannot promote indirect call to ") +
(TargetFuncName.empty() ? Twine(Target) : Twine(TargetFuncName)) + (TargetFuncName.empty() ? Twine(Target) : Twine(TargetFuncName)) +
Twine(" with count of ") + Twine(Count) + ": " + Reason; Twine(" with count of ") + Twine(Count) + ": " + Reason);
emitOptimizationRemarkMissed(F.getContext(), "PGOIndirectCallPromotion",
F, Inst->getDebugLoc(), Msg);
break; break;
} }
Ret.push_back(PromotionCandidate(TargetFunction, Count)); Ret.push_back(PromotionCandidate(TargetFunction, Count));
...@@ -603,10 +602,10 @@ void ICallPromotionFunc::promote(Instruction *Inst, Function *DirectCallee, ...@@ -603,10 +602,10 @@ void ICallPromotionFunc::promote(Instruction *Inst, Function *DirectCallee,
DEBUG(dbgs() << "\n== Basic Blocks After ==\n"); DEBUG(dbgs() << "\n== Basic Blocks After ==\n");
DEBUG(dbgs() << *BB << *DirectCallBB << *IndirectCallBB << *MergeBB << "\n"); DEBUG(dbgs() << *BB << *DirectCallBB << *IndirectCallBB << *MergeBB << "\n");
Twine Msg = Twine("Promote indirect call to ") + DirectCallee->getName() + emitOptimizationRemark(
" with count " + Twine(Count) + " out of " + Twine(TotalCount); F.getContext(), "PGOIndirectCallPromotion", F, Inst->getDebugLoc(),
emitOptimizationRemark(F.getContext(), "PGOIndirectCallPromotion", F, Twine("Promote indirect call to ") + DirectCallee->getName() +
Inst->getDebugLoc(), Msg); " with count " + Twine(Count) + " out of " + Twine(TotalCount));
} }
// Promote indirect-call to conditional direct-call for one callsite. // Promote indirect-call to conditional direct-call for one callsite.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment