Summary: lib/IR/AutoUpgrade.cpp:348 and lib/IR/AutoUpgrade.cpp:350 upset sanitizer.
Reviewers: bkramer
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D22140
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274861
91177308-0d34-0410-b5e6-
96231b3b80d8
assert(F && "Illegal to upgrade a non-existent Function.");
// Quickly eliminate it, if it's not a candidate.
- StringRef Name = F->getName();
+ // Make a copy of the name so that we don't need to worry about the life-time
+ // of StringRef.
+ std::string NameStr = F->getName().str();
+ StringRef Name = NameStr;
if (Name.size() <= 8 || !Name.startswith("llvm."))
return false;
Name = Name.substr(5); // Strip off "llvm."