summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/ProfileData/InstrProfWriter.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/ProfileData/InstrProfWriter.cpp b/llvm/lib/ProfileData/InstrProfWriter.cpp
index 1e18c268892..9bb03e1e77a 100644
--- a/llvm/lib/ProfileData/InstrProfWriter.cpp
+++ b/llvm/lib/ProfileData/InstrProfWriter.cpp
@@ -108,6 +108,8 @@ std::error_code InstrProfWriter::addRecord(InstrProfRecord &&I,
if (NewFunc) {
// We've never seen a function with this name and hash, add it.
Dest = std::move(I);
+ // Fix up the name to avoid dangling reference.
+ Dest.Name = FunctionData.find(Dest.Name)->getKey();
Result = instrprof_error::success;
if (Weight > 1) {
for (auto &Count : Dest.Counts) {
OpenPOWER on IntegriCloud