summaryrefslogtreecommitdiff
path: root/lib/LTO/LTOBackend.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/LTO/LTOBackend.cpp')
-rw-r--r--lib/LTO/LTOBackend.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/LTO/LTOBackend.cpp b/lib/LTO/LTOBackend.cpp
index 668667a535625..f9c41f5c9744e 100644
--- a/lib/LTO/LTOBackend.cpp
+++ b/lib/LTO/LTOBackend.cpp
@@ -136,7 +136,8 @@ createTargetMachine(Config &Conf, const Target *TheTarget, Module &M) {
Conf.CodeModel, Conf.CGOptLevel));
}
-static void runNewPMPasses(Module &Mod, TargetMachine *TM, unsigned OptLevel) {
+static void runNewPMPasses(Module &Mod, TargetMachine *TM, unsigned OptLevel,
+ bool IsThinLTO) {
PassBuilder PB(TM);
AAManager AA;
@@ -180,7 +181,10 @@ static void runNewPMPasses(Module &Mod, TargetMachine *TM, unsigned OptLevel) {
break;
}
- MPM = PB.buildLTODefaultPipeline(OL, false /* DebugLogging */);
+ if (IsThinLTO)
+ MPM = PB.buildThinLTODefaultPipeline(OL, false /* DebugLogging */);
+ else
+ MPM = PB.buildLTODefaultPipeline(OL, false /* DebugLogging */);
MPM.run(Mod, MAM);
// FIXME (davide): verify the output.
@@ -258,17 +262,12 @@ static void runOldPMPasses(Config &Conf, Module &Mod, TargetMachine *TM,
bool opt(Config &Conf, TargetMachine *TM, unsigned Task, Module &Mod,
bool IsThinLTO, ModuleSummaryIndex *ExportSummary,
const ModuleSummaryIndex *ImportSummary) {
- // There's still no ThinLTO pipeline hooked up in the new pass manager,
- // once there is one, we can just remove this.
- if (LTOUseNewPM && IsThinLTO)
- report_fatal_error("ThinLTO not supported with the new PM yet!");
-
// FIXME: Plumb the combined index into the new pass manager.
if (!Conf.OptPipeline.empty())
runNewPMCustomPasses(Mod, TM, Conf.OptPipeline, Conf.AAPipeline,
Conf.DisableVerify);
else if (LTOUseNewPM)
- runNewPMPasses(Mod, TM, Conf.OptLevel);
+ runNewPMPasses(Mod, TM, Conf.OptLevel, IsThinLTO);
else
runOldPMPasses(Conf, Mod, TM, IsThinLTO, ExportSummary, ImportSummary);
return !Conf.PostOptModuleHook || Conf.PostOptModuleHook(Task, Mod);