summaryrefslogtreecommitdiffstats
path: root/llvm/lib/LTO/LTO.cpp
diff options
context:
space:
mode:
authorMehdi Amini <mehdi.amini@apple.com>2016-08-22 06:25:41 +0000
committerMehdi Amini <mehdi.amini@apple.com>2016-08-22 06:25:41 +0000
commitd310b47c23024a8a9c46d5029984855404598369 (patch)
treea1cae6b345aeda2d287f07b42734ea3bdf3ac803 /llvm/lib/LTO/LTO.cpp
parent189b871a62bec4b5e714b6d686126537b95b2b06 (diff)
downloadbcm5719-llvm-d310b47c23024a8a9c46d5029984855404598369.tar.gz
bcm5719-llvm-d310b47c23024a8a9c46d5029984855404598369.zip
[LTO] Add a "CodeGenOnly" option. Allows the client to skip the optimizer.
Summary: Slowly getting on par with libLTO Reviewers: tejohnson Subscribers: llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D23615 llvm-svn: 279416
Diffstat (limited to 'llvm/lib/LTO/LTO.cpp')
-rw-r--r--llvm/lib/LTO/LTO.cpp40
1 files changed, 21 insertions, 19 deletions
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp
index bd11085ed1c..8ceb5a2c1c8 100644
--- a/llvm/lib/LTO/LTO.cpp
+++ b/llvm/lib/LTO/LTO.cpp
@@ -365,27 +365,29 @@ Error LTO::runRegularLTO(AddOutputFn AddOutput) {
!Conf.PreOptModuleHook(0, *RegularLTO.CombinedModule))
return Error();
- for (const auto &R : GlobalResolutions) {
- if (R.second.IRName.empty())
- continue;
- if (R.second.Partition != 0 &&
- R.second.Partition != GlobalResolution::External)
- continue;
+ if (!Conf.CodeGenOnly) {
+ for (const auto &R : GlobalResolutions) {
+ if (R.second.IRName.empty())
+ continue;
+ if (R.second.Partition != 0 &&
+ R.second.Partition != GlobalResolution::External)
+ continue;
+
+ GlobalValue *GV =
+ RegularLTO.CombinedModule->getNamedValue(R.second.IRName);
+ // Ignore symbols defined in other partitions.
+ if (!GV || GV->hasLocalLinkage())
+ continue;
+ GV->setUnnamedAddr(R.second.UnnamedAddr ? GlobalValue::UnnamedAddr::Global
+ : GlobalValue::UnnamedAddr::None);
+ if (R.second.Partition == 0)
+ GV->setLinkage(GlobalValue::InternalLinkage);
+ }
- GlobalValue *GV = RegularLTO.CombinedModule->getNamedValue(R.second.IRName);
- // Ignore symbols defined in other partitions.
- if (!GV || GV->hasLocalLinkage())
- continue;
- GV->setUnnamedAddr(R.second.UnnamedAddr ? GlobalValue::UnnamedAddr::Global
- : GlobalValue::UnnamedAddr::None);
- if (R.second.Partition == 0)
- GV->setLinkage(GlobalValue::InternalLinkage);
+ if (Conf.PostInternalizeModuleHook &&
+ !Conf.PostInternalizeModuleHook(0, *RegularLTO.CombinedModule))
+ return Error();
}
-
- if (Conf.PostInternalizeModuleHook &&
- !Conf.PostInternalizeModuleHook(0, *RegularLTO.CombinedModule))
- return Error();
-
return backend(Conf, AddOutput, RegularLTO.ParallelCodeGenParallelismLevel,
std::move(RegularLTO.CombinedModule));
}
OpenPOWER on IntegriCloud