[llvm] r245722 - llvm-lto: Re-order code.
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 21 12:09:42 PDT 2015
Author: pcc
Date: Fri Aug 21 14:09:42 2015
New Revision: 245722
URL: http://llvm.org/viewvc/llvm-project?rev=245722&view=rev
Log:
llvm-lto: Re-order code.
This saves us from needing to asave a pointer, and will be needed for an
upcoming ownership change.
Modified:
llvm/trunk/tools/llvm-lto/llvm-lto.cpp
Modified: llvm/trunk/tools/llvm-lto/llvm-lto.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-lto/llvm-lto.cpp?rev=245722&r1=245721&r2=245722&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-lto/llvm-lto.cpp (original)
+++ llvm/trunk/tools/llvm-lto/llvm-lto.cpp Fri Aug 21 14:09:42 2015
@@ -207,7 +207,16 @@ int main(int argc, char **argv) {
return 1;
}
- LTOModule *LTOMod = Module.get();
+ unsigned NumSyms = Module->getSymbolCount();
+ for (unsigned I = 0; I < NumSyms; ++I) {
+ StringRef Name = Module->getSymbolName(I);
+ if (!DSOSymbolsSet.count(Name))
+ continue;
+ lto_symbol_attributes Attrs = Module->getSymbolAttributes(I);
+ unsigned Scope = Attrs & LTO_SYMBOL_SCOPE_MASK;
+ if (Scope != LTO_SYMBOL_SCOPE_DEFAULT_CAN_BE_HIDDEN)
+ KeptDSOSyms.push_back(Name);
+ }
// We use the first input module as the destination module when
// SetMergedModule is true.
@@ -216,17 +225,6 @@ int main(int argc, char **argv) {
CodeGen.setModule(Module.release());
} else if (!CodeGen.addModule(Module.get()))
return 1;
-
- unsigned NumSyms = LTOMod->getSymbolCount();
- for (unsigned I = 0; I < NumSyms; ++I) {
- StringRef Name = LTOMod->getSymbolName(I);
- if (!DSOSymbolsSet.count(Name))
- continue;
- lto_symbol_attributes Attrs = LTOMod->getSymbolAttributes(I);
- unsigned Scope = Attrs & LTO_SYMBOL_SCOPE_MASK;
- if (Scope != LTO_SYMBOL_SCOPE_DEFAULT_CAN_BE_HIDDEN)
- KeptDSOSyms.push_back(Name);
- }
}
// Add all the exported symbols to the table of symbols to preserve.
More information about the llvm-commits
mailing list