Chandler Carruth | 6644538 | 2014-01-11 08:16:35 +0000 | [diff] [blame] | 1 | //===- NewPMDriver.cpp - Driver for opt with new PM -----------------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | /// \file |
| 10 | /// |
| 11 | /// This file is just a split of the code that logically belongs in opt.cpp but |
| 12 | /// that includes the new pass manager headers. |
| 13 | /// |
| 14 | //===----------------------------------------------------------------------===// |
| 15 | |
| 16 | #include "NewPMDriver.h" |
Chandler Carruth | 6644538 | 2014-01-11 08:16:35 +0000 | [diff] [blame] | 17 | #include "llvm/ADT/StringRef.h" |
Chandler Carruth | edf5996 | 2016-02-18 09:45:17 +0000 | [diff] [blame] | 18 | #include "llvm/Analysis/AliasAnalysis.h" |
Chandler Carruth | 572e340 | 2014-04-21 11:12:00 +0000 | [diff] [blame] | 19 | #include "llvm/Analysis/CGSCCPassManager.h" |
Chandler Carruth | b7bdfd6 | 2014-01-13 07:38:24 +0000 | [diff] [blame] | 20 | #include "llvm/Bitcode/BitcodeWriterPass.h" |
Philip Pfaffe | 59d690b | 2017-08-04 09:28:09 +0000 | [diff] [blame^] | 21 | #include "llvm/Config/config.h" |
Chandler Carruth | 64764b4 | 2015-01-14 10:19:28 +0000 | [diff] [blame] | 22 | #include "llvm/IR/Dominators.h" |
Chandler Carruth | b353c3f | 2014-01-13 05:16:45 +0000 | [diff] [blame] | 23 | #include "llvm/IR/IRPrintingPasses.h" |
Chandler Carruth | 6644538 | 2014-01-11 08:16:35 +0000 | [diff] [blame] | 24 | #include "llvm/IR/LLVMContext.h" |
| 25 | #include "llvm/IR/Module.h" |
| 26 | #include "llvm/IR/PassManager.h" |
Chandler Carruth | 4d35631 | 2014-01-20 11:34:08 +0000 | [diff] [blame] | 27 | #include "llvm/IR/Verifier.h" |
Chandler Carruth | 1ff7724 | 2015-03-07 09:02:36 +0000 | [diff] [blame] | 28 | #include "llvm/Passes/PassBuilder.h" |
Chandler Carruth | 6644538 | 2014-01-11 08:16:35 +0000 | [diff] [blame] | 29 | #include "llvm/Support/CommandLine.h" |
Chandler Carruth | b353c3f | 2014-01-13 05:16:45 +0000 | [diff] [blame] | 30 | #include "llvm/Support/ErrorHandling.h" |
Chandler Carruth | 6644538 | 2014-01-11 08:16:35 +0000 | [diff] [blame] | 31 | #include "llvm/Support/ToolOutputFile.h" |
Chandler Carruth | e038552 | 2015-02-01 10:11:22 +0000 | [diff] [blame] | 32 | #include "llvm/Target/TargetMachine.h" |
Tim Shen | 6b411418 | 2017-06-01 01:02:12 +0000 | [diff] [blame] | 33 | #include "llvm/Transforms/IPO/ThinLTOBitcodeWriter.h" |
Chandler Carruth | 3bab7e1 | 2017-01-11 09:43:56 +0000 | [diff] [blame] | 34 | #include "llvm/Transforms/Scalar/LoopPassManager.h" |
Chandler Carruth | 6644538 | 2014-01-11 08:16:35 +0000 | [diff] [blame] | 35 | |
| 36 | using namespace llvm; |
Chandler Carruth | 949282e | 2014-01-13 03:08:40 +0000 | [diff] [blame] | 37 | using namespace opt_tool; |
Chandler Carruth | 6644538 | 2014-01-11 08:16:35 +0000 | [diff] [blame] | 38 | |
Chandler Carruth | 14a759e | 2015-01-13 22:42:38 +0000 | [diff] [blame] | 39 | static cl::opt<bool> |
| 40 | DebugPM("debug-pass-manager", cl::Hidden, |
| 41 | cl::desc("Print pass management debugging information")); |
| 42 | |
Chandler Carruth | edf5996 | 2016-02-18 09:45:17 +0000 | [diff] [blame] | 43 | // This flag specifies a textual description of the alias analysis pipeline to |
| 44 | // use when querying for aliasing information. It only works in concert with |
| 45 | // the "passes" flag above. |
| 46 | static cl::opt<std::string> |
| 47 | AAPipeline("aa-pipeline", |
| 48 | cl::desc("A textual description of the alias analysis " |
| 49 | "pipeline for handling managed aliasing queries"), |
| 50 | cl::Hidden); |
| 51 | |
Philip Pfaffe | 730f2f9 | 2017-07-10 10:57:55 +0000 | [diff] [blame] | 52 | /// {{@ These options accept textual pipeline descriptions which will be |
| 53 | /// inserted into default pipelines at the respective extension points |
| 54 | static cl::opt<std::string> PeepholeEPPipeline( |
| 55 | "passes-ep-peephole", |
| 56 | cl::desc("A textual description of the function pass pipeline inserted at " |
| 57 | "the Peephole extension points into default pipelines"), |
| 58 | cl::Hidden); |
| 59 | static cl::opt<std::string> LateLoopOptimizationsEPPipeline( |
| 60 | "passes-ep-late-loop-optimizations", |
| 61 | cl::desc( |
| 62 | "A textual description of the loop pass pipeline inserted at " |
| 63 | "the LateLoopOptimizations extension point into default pipelines"), |
| 64 | cl::Hidden); |
| 65 | static cl::opt<std::string> LoopOptimizerEndEPPipeline( |
| 66 | "passes-ep-loop-optimizer-end", |
| 67 | cl::desc("A textual description of the loop pass pipeline inserted at " |
| 68 | "the LoopOptimizerEnd extension point into default pipelines"), |
| 69 | cl::Hidden); |
| 70 | static cl::opt<std::string> ScalarOptimizerLateEPPipeline( |
| 71 | "passes-ep-scalar-optimizer-late", |
| 72 | cl::desc("A textual description of the function pass pipeline inserted at " |
| 73 | "the ScalarOptimizerLate extension point into default pipelines"), |
| 74 | cl::Hidden); |
| 75 | static cl::opt<std::string> CGSCCOptimizerLateEPPipeline( |
| 76 | "passes-ep-cgscc-optimizer-late", |
| 77 | cl::desc("A textual description of the cgscc pass pipeline inserted at " |
| 78 | "the CGSCCOptimizerLate extension point into default pipelines"), |
| 79 | cl::Hidden); |
| 80 | static cl::opt<std::string> VectorizerStartEPPipeline( |
| 81 | "passes-ep-vectorizer-start", |
| 82 | cl::desc("A textual description of the function pass pipeline inserted at " |
| 83 | "the VectorizerStart extension point into default pipelines"), |
| 84 | cl::Hidden); |
Dehao Chen | 7b05a27 | 2017-07-26 02:00:43 +0000 | [diff] [blame] | 85 | enum PGOKind { NoPGO, InstrGen, InstrUse, SampleUse }; |
| 86 | static cl::opt<PGOKind> PGOKindFlag( |
| 87 | "pgo-kind", cl::init(NoPGO), cl::Hidden, |
| 88 | cl::desc("The kind of profile guided optimization"), |
| 89 | cl::values(clEnumValN(NoPGO, "nopgo", "Do not use PGO."), |
| 90 | clEnumValN(InstrGen, "new-pm-pgo-instr-gen-pipeline", |
| 91 | "Instrument the IR to generate profile."), |
| 92 | clEnumValN(InstrUse, "new-pm-pgo-instr-use-pipeline", |
| 93 | "Use instrumented profile to guide PGO."), |
| 94 | clEnumValN(SampleUse, "new-pm-pgo-sample-use-pipeline", |
| 95 | "Use sampled profile to guide PGO."))); |
| 96 | static cl::opt<std::string> ProfileFile( |
| 97 | "profile-file", cl::desc("Path to the profile."), cl::Hidden); |
Dehao Chen | e90d015 | 2017-07-26 15:01:20 +0000 | [diff] [blame] | 98 | static cl::opt<bool> DebugInfoForProfiling( |
| 99 | "new-pm-debug-info-for-profiling", cl::init(false), cl::Hidden, |
| 100 | cl::desc("Emit special debug info to enable PGO profile generation.")); |
Philip Pfaffe | 730f2f9 | 2017-07-10 10:57:55 +0000 | [diff] [blame] | 101 | /// @}} |
| 102 | |
Philip Pfaffe | b4d500f | 2017-07-11 11:17:44 +0000 | [diff] [blame] | 103 | template <typename PassManagerT> |
| 104 | bool tryParsePipelineText(PassBuilder &PB, StringRef PipelineText) { |
| 105 | if (PipelineText.empty()) |
| 106 | return false; |
| 107 | |
| 108 | // Verify the pipeline is parseable: |
| 109 | PassManagerT PM; |
| 110 | if (PB.parsePassPipeline(PM, PipelineText)) |
| 111 | return true; |
| 112 | |
| 113 | errs() << "Could not parse pipeline '" << PipelineText |
| 114 | << "'. I'm going to igore it.\n"; |
| 115 | return false; |
| 116 | } |
| 117 | |
Philip Pfaffe | 730f2f9 | 2017-07-10 10:57:55 +0000 | [diff] [blame] | 118 | /// If one of the EPPipeline command line options was given, register callbacks |
| 119 | /// for parsing and inserting the given pipeline |
| 120 | static void registerEPCallbacks(PassBuilder &PB, bool VerifyEachPass, |
| 121 | bool DebugLogging) { |
Philip Pfaffe | b4d500f | 2017-07-11 11:17:44 +0000 | [diff] [blame] | 122 | if (tryParsePipelineText<FunctionPassManager>(PB, PeepholeEPPipeline)) |
Philip Pfaffe | a3b8416 | 2017-07-10 12:48:51 +0000 | [diff] [blame] | 123 | PB.registerPeepholeEPCallback([&PB, VerifyEachPass, DebugLogging]( |
| 124 | FunctionPassManager &PM, PassBuilder::OptimizationLevel Level) { |
Philip Pfaffe | b4d500f | 2017-07-11 11:17:44 +0000 | [diff] [blame] | 125 | PB.parsePassPipeline(PM, PeepholeEPPipeline, VerifyEachPass, |
| 126 | DebugLogging); |
Philip Pfaffe | a3b8416 | 2017-07-10 12:48:51 +0000 | [diff] [blame] | 127 | }); |
Philip Pfaffe | b4d500f | 2017-07-11 11:17:44 +0000 | [diff] [blame] | 128 | if (tryParsePipelineText<LoopPassManager>(PB, |
| 129 | LateLoopOptimizationsEPPipeline)) |
Philip Pfaffe | 730f2f9 | 2017-07-10 10:57:55 +0000 | [diff] [blame] | 130 | PB.registerLateLoopOptimizationsEPCallback( |
Philip Pfaffe | a3b8416 | 2017-07-10 12:48:51 +0000 | [diff] [blame] | 131 | [&PB, VerifyEachPass, DebugLogging]( |
| 132 | LoopPassManager &PM, PassBuilder::OptimizationLevel Level) { |
Philip Pfaffe | b4d500f | 2017-07-11 11:17:44 +0000 | [diff] [blame] | 133 | PB.parsePassPipeline(PM, LateLoopOptimizationsEPPipeline, |
| 134 | VerifyEachPass, DebugLogging); |
Philip Pfaffe | 730f2f9 | 2017-07-10 10:57:55 +0000 | [diff] [blame] | 135 | }); |
Philip Pfaffe | b4d500f | 2017-07-11 11:17:44 +0000 | [diff] [blame] | 136 | if (tryParsePipelineText<LoopPassManager>(PB, LoopOptimizerEndEPPipeline)) |
Philip Pfaffe | a3b8416 | 2017-07-10 12:48:51 +0000 | [diff] [blame] | 137 | PB.registerLoopOptimizerEndEPCallback([&PB, VerifyEachPass, DebugLogging]( |
| 138 | LoopPassManager &PM, PassBuilder::OptimizationLevel Level) { |
Philip Pfaffe | b4d500f | 2017-07-11 11:17:44 +0000 | [diff] [blame] | 139 | PB.parsePassPipeline(PM, LoopOptimizerEndEPPipeline, VerifyEachPass, |
| 140 | DebugLogging); |
Philip Pfaffe | a3b8416 | 2017-07-10 12:48:51 +0000 | [diff] [blame] | 141 | }); |
Philip Pfaffe | b4d500f | 2017-07-11 11:17:44 +0000 | [diff] [blame] | 142 | if (tryParsePipelineText<FunctionPassManager>(PB, |
| 143 | ScalarOptimizerLateEPPipeline)) |
Philip Pfaffe | 730f2f9 | 2017-07-10 10:57:55 +0000 | [diff] [blame] | 144 | PB.registerScalarOptimizerLateEPCallback( |
Philip Pfaffe | a3b8416 | 2017-07-10 12:48:51 +0000 | [diff] [blame] | 145 | [&PB, VerifyEachPass, DebugLogging]( |
| 146 | FunctionPassManager &PM, PassBuilder::OptimizationLevel Level) { |
Philip Pfaffe | b4d500f | 2017-07-11 11:17:44 +0000 | [diff] [blame] | 147 | PB.parsePassPipeline(PM, ScalarOptimizerLateEPPipeline, |
| 148 | VerifyEachPass, DebugLogging); |
Philip Pfaffe | 730f2f9 | 2017-07-10 10:57:55 +0000 | [diff] [blame] | 149 | }); |
Philip Pfaffe | b4d500f | 2017-07-11 11:17:44 +0000 | [diff] [blame] | 150 | if (tryParsePipelineText<CGSCCPassManager>(PB, CGSCCOptimizerLateEPPipeline)) |
Philip Pfaffe | a3b8416 | 2017-07-10 12:48:51 +0000 | [diff] [blame] | 151 | PB.registerCGSCCOptimizerLateEPCallback([&PB, VerifyEachPass, DebugLogging]( |
| 152 | CGSCCPassManager &PM, PassBuilder::OptimizationLevel Level) { |
Philip Pfaffe | b4d500f | 2017-07-11 11:17:44 +0000 | [diff] [blame] | 153 | PB.parsePassPipeline(PM, CGSCCOptimizerLateEPPipeline, VerifyEachPass, |
| 154 | DebugLogging); |
Philip Pfaffe | a3b8416 | 2017-07-10 12:48:51 +0000 | [diff] [blame] | 155 | }); |
Philip Pfaffe | b4d500f | 2017-07-11 11:17:44 +0000 | [diff] [blame] | 156 | if (tryParsePipelineText<FunctionPassManager>(PB, VectorizerStartEPPipeline)) |
Philip Pfaffe | a3b8416 | 2017-07-10 12:48:51 +0000 | [diff] [blame] | 157 | PB.registerVectorizerStartEPCallback([&PB, VerifyEachPass, DebugLogging]( |
| 158 | FunctionPassManager &PM, PassBuilder::OptimizationLevel Level) { |
Philip Pfaffe | b4d500f | 2017-07-11 11:17:44 +0000 | [diff] [blame] | 159 | PB.parsePassPipeline(PM, VectorizerStartEPPipeline, VerifyEachPass, |
| 160 | DebugLogging); |
Philip Pfaffe | a3b8416 | 2017-07-10 12:48:51 +0000 | [diff] [blame] | 161 | }); |
Philip Pfaffe | 730f2f9 | 2017-07-10 10:57:55 +0000 | [diff] [blame] | 162 | } |
| 163 | |
Philip Pfaffe | 59d690b | 2017-08-04 09:28:09 +0000 | [diff] [blame^] | 164 | #ifdef LINK_POLLY_INTO_TOOLS |
| 165 | namespace polly { |
| 166 | void RegisterPollyPasses(PassBuilder &); |
| 167 | } |
| 168 | #endif |
| 169 | |
Tim Shen | 6b411418 | 2017-06-01 01:02:12 +0000 | [diff] [blame] | 170 | bool llvm::runPassPipeline(StringRef Arg0, Module &M, TargetMachine *TM, |
| 171 | tool_output_file *Out, |
| 172 | tool_output_file *ThinLTOLinkOut, |
Chandler Carruth | e038552 | 2015-02-01 10:11:22 +0000 | [diff] [blame] | 173 | StringRef PassPipeline, OutputKind OK, |
Duncan P. N. Exon Smith | 679db33 | 2015-04-15 00:34:24 +0000 | [diff] [blame] | 174 | VerifierKind VK, |
Duncan P. N. Exon Smith | 8a74f68 | 2015-04-15 02:38:06 +0000 | [diff] [blame] | 175 | bool ShouldPreserveAssemblyUseListOrder, |
Teresa Johnson | f93b246 | 2016-08-12 13:53:02 +0000 | [diff] [blame] | 176 | bool ShouldPreserveBitcodeUseListOrder, |
| 177 | bool EmitSummaryIndex, bool EmitModuleHash) { |
Philip Pfaffe | 730f2f9 | 2017-07-10 10:57:55 +0000 | [diff] [blame] | 178 | bool VerifyEachPass = VK == VK_VerifyEachPass; |
Dehao Chen | 7b05a27 | 2017-07-26 02:00:43 +0000 | [diff] [blame] | 179 | |
| 180 | Optional<PGOOptions> P; |
| 181 | switch (PGOKindFlag) { |
| 182 | case InstrGen: |
| 183 | P = PGOOptions(ProfileFile, "", "", true); |
| 184 | break; |
| 185 | case InstrUse: |
| 186 | P = PGOOptions("", ProfileFile, "", false); |
| 187 | break; |
| 188 | case SampleUse: |
| 189 | P = PGOOptions("", "", ProfileFile, false); |
| 190 | break; |
| 191 | case NoPGO: |
Dehao Chen | e90d015 | 2017-07-26 15:01:20 +0000 | [diff] [blame] | 192 | if (DebugInfoForProfiling) |
| 193 | P = PGOOptions("", "", "", false, true); |
| 194 | else |
| 195 | P = None; |
Dehao Chen | 7b05a27 | 2017-07-26 02:00:43 +0000 | [diff] [blame] | 196 | } |
| 197 | PassBuilder PB(TM, P); |
Philip Pfaffe | 730f2f9 | 2017-07-10 10:57:55 +0000 | [diff] [blame] | 198 | registerEPCallbacks(PB, VerifyEachPass, DebugPM); |
Chandler Carruth | 2dc92e9 | 2015-02-01 07:40:05 +0000 | [diff] [blame] | 199 | |
Philip Pfaffe | 59d690b | 2017-08-04 09:28:09 +0000 | [diff] [blame^] | 200 | #ifdef LINK_POLLY_INTO_TOOLS |
| 201 | polly::RegisterPollyPasses(PB); |
| 202 | #endif |
| 203 | |
Chandler Carruth | edf5996 | 2016-02-18 09:45:17 +0000 | [diff] [blame] | 204 | // Specially handle the alias analysis manager so that we can register |
| 205 | // a custom pipeline of AA passes with it. |
| 206 | AAManager AA; |
| 207 | if (!PB.parseAAPipeline(AA, AAPipeline)) { |
| 208 | errs() << Arg0 << ": unable to parse AA pipeline description.\n"; |
| 209 | return false; |
| 210 | } |
| 211 | |
Justin Bogner | eecc3c8 | 2016-02-25 07:23:08 +0000 | [diff] [blame] | 212 | LoopAnalysisManager LAM(DebugPM); |
Chandler Carruth | 14a759e | 2015-01-13 22:42:38 +0000 | [diff] [blame] | 213 | FunctionAnalysisManager FAM(DebugPM); |
| 214 | CGSCCAnalysisManager CGAM(DebugPM); |
| 215 | ModuleAnalysisManager MAM(DebugPM); |
Chandler Carruth | 4d35631 | 2014-01-20 11:34:08 +0000 | [diff] [blame] | 216 | |
Chandler Carruth | edf5996 | 2016-02-18 09:45:17 +0000 | [diff] [blame] | 217 | // Register the AA manager first so that our version is the one used. |
| 218 | FAM.registerPass([&] { return std::move(AA); }); |
| 219 | |
Chandler Carruth | b70f673 | 2015-01-06 02:21:37 +0000 | [diff] [blame] | 220 | // Register all the basic analyses with the managers. |
Chandler Carruth | 1ff7724 | 2015-03-07 09:02:36 +0000 | [diff] [blame] | 221 | PB.registerModuleAnalyses(MAM); |
| 222 | PB.registerCGSCCAnalyses(CGAM); |
| 223 | PB.registerFunctionAnalyses(FAM); |
Justin Bogner | eecc3c8 | 2016-02-25 07:23:08 +0000 | [diff] [blame] | 224 | PB.registerLoopAnalyses(LAM); |
Davide Italiano | b6ccd6b | 2016-05-14 23:21:50 +0000 | [diff] [blame] | 225 | PB.crossRegisterProxies(LAM, FAM, CGAM, MAM); |
Chandler Carruth | c68d082 | 2014-02-06 04:25:13 +0000 | [diff] [blame] | 226 | |
Chandler Carruth | 14a759e | 2015-01-13 22:42:38 +0000 | [diff] [blame] | 227 | ModulePassManager MPM(DebugPM); |
Chandler Carruth | 4d35631 | 2014-01-20 11:34:08 +0000 | [diff] [blame] | 228 | if (VK > VK_NoVerifier) |
| 229 | MPM.addPass(VerifierPass()); |
| 230 | |
Philip Pfaffe | 730f2f9 | 2017-07-10 10:57:55 +0000 | [diff] [blame] | 231 | if (!PB.parsePassPipeline(MPM, PassPipeline, VerifyEachPass, DebugPM)) { |
Chandler Carruth | 6644538 | 2014-01-11 08:16:35 +0000 | [diff] [blame] | 232 | errs() << Arg0 << ": unable to parse pass pipeline description.\n"; |
| 233 | return false; |
| 234 | } |
| 235 | |
Chandler Carruth | 4d35631 | 2014-01-20 11:34:08 +0000 | [diff] [blame] | 236 | if (VK > VK_NoVerifier) |
| 237 | MPM.addPass(VerifierPass()); |
| 238 | |
Chandler Carruth | b353c3f | 2014-01-13 05:16:45 +0000 | [diff] [blame] | 239 | // Add any relevant output pass at the end of the pipeline. |
| 240 | switch (OK) { |
| 241 | case OK_NoOutput: |
| 242 | break; // No output pass needed. |
| 243 | case OK_OutputAssembly: |
Duncan P. N. Exon Smith | 8a74f68 | 2015-04-15 02:38:06 +0000 | [diff] [blame] | 244 | MPM.addPass( |
| 245 | PrintModulePass(Out->os(), "", ShouldPreserveAssemblyUseListOrder)); |
Chandler Carruth | b353c3f | 2014-01-13 05:16:45 +0000 | [diff] [blame] | 246 | break; |
| 247 | case OK_OutputBitcode: |
Teresa Johnson | f93b246 | 2016-08-12 13:53:02 +0000 | [diff] [blame] | 248 | MPM.addPass(BitcodeWriterPass(Out->os(), ShouldPreserveBitcodeUseListOrder, |
| 249 | EmitSummaryIndex, EmitModuleHash)); |
Chandler Carruth | b7bdfd6 | 2014-01-13 07:38:24 +0000 | [diff] [blame] | 250 | break; |
Tim Shen | 6b411418 | 2017-06-01 01:02:12 +0000 | [diff] [blame] | 251 | case OK_OutputThinLTOBitcode: |
| 252 | MPM.addPass(ThinLTOBitcodeWriterPass( |
| 253 | Out->os(), ThinLTOLinkOut ? &ThinLTOLinkOut->os() : nullptr)); |
| 254 | break; |
Chandler Carruth | b353c3f | 2014-01-13 05:16:45 +0000 | [diff] [blame] | 255 | } |
| 256 | |
| 257 | // Before executing passes, print the final values of the LLVM options. |
| 258 | cl::PrintOptionValues(); |
| 259 | |
Chandler Carruth | 6644538 | 2014-01-11 08:16:35 +0000 | [diff] [blame] | 260 | // Now that we have all of the passes ready, run them. |
Chandler Carruth | b47f801 | 2016-03-11 11:05:24 +0000 | [diff] [blame] | 261 | MPM.run(M, MAM); |
Chandler Carruth | 6644538 | 2014-01-11 08:16:35 +0000 | [diff] [blame] | 262 | |
| 263 | // Declare success. |
Tim Shen | 6b411418 | 2017-06-01 01:02:12 +0000 | [diff] [blame] | 264 | if (OK != OK_NoOutput) { |
Chandler Carruth | 6644538 | 2014-01-11 08:16:35 +0000 | [diff] [blame] | 265 | Out->keep(); |
Tim Shen | 6b411418 | 2017-06-01 01:02:12 +0000 | [diff] [blame] | 266 | if (OK == OK_OutputThinLTOBitcode && ThinLTOLinkOut) |
| 267 | ThinLTOLinkOut->keep(); |
| 268 | } |
Chandler Carruth | 6644538 | 2014-01-11 08:16:35 +0000 | [diff] [blame] | 269 | return true; |
| 270 | } |