diff options
Diffstat (limited to 'llvm/lib/LTO/LTOBackend.cpp')
-rw-r--r-- | llvm/lib/LTO/LTOBackend.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp index 935152b970d..a89364e46a0 100644 --- a/llvm/lib/LTO/LTOBackend.cpp +++ b/llvm/lib/LTO/LTOBackend.cpp @@ -224,8 +224,9 @@ Error lto::backend(Config &C, AddOutputFn AddOutput, std::unique_ptr<TargetMachine> TM = createTargetMachine(C, M->getTargetTriple(), *TOrErr); - if (!opt(C, TM.get(), 0, *M, /*IsThinLto=*/false)) - return Error(); + if (!C.CodeGenOnly) + if (!opt(C, TM.get(), 0, *M, /*IsThinLto=*/false)) + return Error(); if (ParallelCodeGenParallelismLevel == 1) codegen(C, TM.get(), AddOutput, 0, *M); @@ -247,6 +248,11 @@ Error lto::thinBackend(Config &Conf, unsigned Task, AddOutputFn AddOutput, std::unique_ptr<TargetMachine> TM = createTargetMachine(Conf, Mod.getTargetTriple(), *TOrErr); + if (Conf.CodeGenOnly) { + codegen(Conf, TM.get(), AddOutput, Task, Mod); + return Error(); + } + if (Conf.PreOptModuleHook && !Conf.PreOptModuleHook(Task, Mod)) return Error(); |