Index: include/llvm/LTO/Config.h =================================================================== --- include/llvm/LTO/Config.h +++ include/llvm/LTO/Config.h @@ -49,6 +49,9 @@ /// Disable entirely the optimizer, including importing for ThinLTO bool CodeGenOnly = false; + /// Skip code generation, the client is responsible for it. + bool SkipCodeGen = false; + /// If this field is set, the set of passes run in the middle-end optimizer /// will be the one specified by the string. Only works with the new pass /// manager as the old one doesn't have this ability. Index: lib/LTO/LTOBackend.cpp =================================================================== --- lib/LTO/LTOBackend.cpp +++ lib/LTO/LTOBackend.cpp @@ -269,6 +269,9 @@ if (Conf.PreCodeGenModuleHook && !Conf.PreCodeGenModuleHook(Task, Mod)) return; + if (Conf.SkipCodeGen) + return; + auto Stream = AddStream(Task); legacy::PassManager CodeGenPasses; if (TM->addPassesToEmitFile(CodeGenPasses, *Stream->OS, Conf.CGFileType))