1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00

[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
This commit is contained in:
Rong Xu 2016-04-28 17:49:56 +00:00
parent 29d0278b98
commit 5185fd96c2

View File

@ -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.