[llvm] 646ad49 - [llvm-jitlink] Avoid some SymbolStringPtr copies.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 15 15:23:26 PST 2024


Author: Lang Hames
Date: 2024-12-16T10:15:35+11:00
New Revision: 646ad49eacea19cfd656145cd41ae5ef99029a97

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

LOG: [llvm-jitlink] Avoid some SymbolStringPtr copies.

Added: 
    

Modified: 
    llvm/tools/llvm-jitlink/llvm-jitlink.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
index 3c58b8934462a2..e3ed2b624b06a8 100644
--- a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
+++ b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
@@ -740,8 +740,7 @@ getTestObjectFileInterface(Session &S, MemoryBufferRef O) {
                !(*SymFlagsOrErr & object::BasicSymbolRef::SF_Global))
       continue;
 
-    auto InternedName = S.ES.intern(*Name);
-    I->SymbolFlags[InternedName] = std::move(*SymFlags);
+    I->SymbolFlags[S.ES.intern(*Name)] = std::move(*SymFlags);
   }
 
   return I;
@@ -1711,8 +1710,8 @@ static Error addAbsoluteSymbols(Session &S,
       return Err;
 
     // Register the absolute symbol with the session symbol infos.
-    S.SymbolInfos[InternedName] = {ArrayRef<char>(), Addr,
-                                   AbsDef.getFlags().getTargetFlags()};
+    S.SymbolInfos[std::move(InternedName)] =
+      {ArrayRef<char>(), Addr, AbsDef.getFlags().getTargetFlags()};
   }
 
   return Error::success();


        


More information about the llvm-commits mailing list