summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-lto/llvm-lto.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2015-08-21 19:09:42 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2015-08-21 19:09:42 +0000
commit55217439181a9407f6237b5f146dfe08fa8bc59e (patch)
tree51345287048540f7bc9c973fead0646472b19be4 /llvm/tools/llvm-lto/llvm-lto.cpp
parent910a059e428bc1258cc1646ed1beabb8132d5754 (diff)
downloadbcm5719-llvm-55217439181a9407f6237b5f146dfe08fa8bc59e.tar.gz
bcm5719-llvm-55217439181a9407f6237b5f146dfe08fa8bc59e.zip
llvm-lto: Re-order code.
This saves us from needing to asave a pointer, and will be needed for an upcoming ownership change. llvm-svn: 245722
Diffstat (limited to 'llvm/tools/llvm-lto/llvm-lto.cpp')
-rw-r--r--llvm/tools/llvm-lto/llvm-lto.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/llvm/tools/llvm-lto/llvm-lto.cpp b/llvm/tools/llvm-lto/llvm-lto.cpp
index 9678c8397e0..7f87859f3b2 100644
--- a/llvm/tools/llvm-lto/llvm-lto.cpp
+++ b/llvm/tools/llvm-lto/llvm-lto.cpp
@@ -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.
OpenPOWER on IntegriCloud