aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-08-08 22:01:55 +0000
committerBill Wendling <isanbard@gmail.com>2012-08-08 22:01:55 +0000
commit5682527882aa3ddc74d0b283496fedd069a8e55d (patch)
tree2fb2b6124be68390f5fe288b8875fb5f32245c00 /tools
parent5f91a99427c0be5899835fc6407c6e55bfcd606d (diff)
downloadexternal_llvm-5682527882aa3ddc74d0b283496fedd069a8e55d.zip
external_llvm-5682527882aa3ddc74d0b283496fedd069a8e55d.tar.gz
external_llvm-5682527882aa3ddc74d0b283496fedd069a8e55d.tar.bz2
Cache a commonly used reference.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161529 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/lto/LTOModule.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/tools/lto/LTOModule.cpp b/tools/lto/LTOModule.cpp
index 58a0e1f..c5b3d10 100644
--- a/tools/lto/LTOModule.cpp
+++ b/tools/lto/LTOModule.cpp
@@ -798,21 +798,20 @@ bool LTOModule::addAsmGlobalSymbols(std::string &errMsg) {
OwningPtr<MCAsmParser> Parser(createMCAsmParser(SrcMgr,
_context, *Streamer,
*_target->getMCAsmInfo()));
- OwningPtr<MCSubtargetInfo> STI(_target->getTarget().
- createMCSubtargetInfo(_target->getTargetTriple(),
- _target->getTargetCPU(),
- _target->getTargetFeatureString()));
- OwningPtr<MCTargetAsmParser>
- TAP(_target->getTarget().createMCAsmParser(*STI, *Parser.get()));
+ const Target &T = _target->getTarget();
+ OwningPtr<MCSubtargetInfo>
+ STI(T.createMCSubtargetInfo(_target->getTargetTriple(),
+ _target->getTargetCPU(),
+ _target->getTargetFeatureString()));
+ OwningPtr<MCTargetAsmParser> TAP(T.createMCAsmParser(*STI, *Parser.get()));
if (!TAP) {
- errMsg = "target " + std::string(_target->getTarget().getName()) +
- " does not define AsmParser.";
+ errMsg = "target " + std::string(T.getName()) +
+ " does not define AsmParser.";
return true;
}
Parser->setTargetParser(*TAP);
- int Res = Parser->Run(false);
- if (Res)
+ if (Parser->Run(false))
return true;
for (RecordStreamer::const_iterator i = Streamer->begin(),
@@ -827,6 +826,7 @@ bool LTOModule::addAsmGlobalSymbols(std::string &errMsg) {
Value == RecordStreamer::Used)
addAsmGlobalSymbolUndef(Key.data());
}
+
return false;
}
@@ -834,8 +834,10 @@ bool LTOModule::addAsmGlobalSymbols(std::string &errMsg) {
static bool isDeclaration(const GlobalValue &V) {
if (V.hasAvailableExternallyLinkage())
return true;
+
if (V.isMaterializable())
return false;
+
return V.isDeclaration();
}