[llvm] 595c418 - [LTO] Avoid repeated Triple construction. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 28 13:39:46 PDT 2021


Author: Fangrui Song
Date: 2021-09-28T13:39:41-07:00
New Revision: 595c418ad6a1230103000dcebdb158129d033077

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

LOG: [LTO] Avoid repeated Triple construction. NFC

Added: 
    

Modified: 
    llvm/lib/LTO/LTO.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp
index 86f38f5126e66..111fdc8f939ea 100644
--- a/llvm/lib/LTO/LTO.cpp
+++ b/llvm/lib/LTO/LTO.cpp
@@ -537,12 +537,12 @@ void LTO::addModuleToGlobalRes(ArrayRef<InputFile::Symbol> Syms,
   auto *ResI = Res.begin();
   auto *ResE = Res.end();
   (void)ResE;
+  const Triple TT(RegularLTO.CombinedModule->getTargetTriple());
   for (const InputFile::Symbol &Sym : Syms) {
     assert(ResI != ResE);
     SymbolResolution Res = *ResI++;
 
     StringRef Name = Sym.getName();
-    Triple TT(RegularLTO.CombinedModule->getTargetTriple());
     // Strip the __imp_ prefix from COFF dllimport symbols (similar to the
     // way they are handled by lld), otherwise we can end up with two
     // global resolutions (one with and one for a copy of the symbol without).


        


More information about the llvm-commits mailing list