[llvm] c67079f - [PGO] Fix dead StringRef access

Christian Ulmann via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 27 12:43:08 PDT 2023


Author: Christian Ulmann
Date: 2023-04-27T19:42:56Z
New Revision: c67079f1be713fa558b3773562bd1eeb156cadbd

URL: https://github.com/llvm/llvm-project/commit/c67079f1be713fa558b3773562bd1eeb156cadbd
DIFF: https://github.com/llvm/llvm-project/commit/c67079f1be713fa558b3773562bd1eeb156cadbd.diff

LOG: [PGO] Fix dead StringRef access

This commit fixes a dead StringRef access introduced in
https://reviews.llvm.org/D149324

Added: 
    

Modified: 
    llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
index 2c73f5a7eeaf..416f559bda34 100644
--- a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
+++ b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
@@ -722,7 +722,7 @@ template <class Edge, class BBInfo>
 void FuncPGOInstrumentation<Edge, BBInfo>::renameComdatFunction() {
   if (!canRenameComdat(F, ComdatMembers))
     return;
-  StringRef OrigName = F.getName();
+  std::string OrigName = F.getName().str();
   std::string NewFuncName =
       Twine(F.getName() + "." + Twine(FunctionHash)).str();
   F.setName(Twine(NewFuncName));


        


More information about the llvm-commits mailing list