llvm.org GIT mirror llvm / a950eb9
[ThinLTO] Move -lto-use-new-pm to llvm-lto2, and change it to -use-new-pm. Summary: As we teach Clang to use ThinkLTO + new PM, it's good for the users to inject through Config, instead of setting a flag in the LTOBackend library. Move the flag to llvm-lto2. As it moves to llvm-lto2, a new name -use-new-pm seems simpler and as clear. Reviewers: davide, tejohnson Subscribers: mehdi_amini, Prazek, inglorion, eraman, chandlerc, llvm-commits Differential Revision: https://reviews.llvm.org/D33799 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304492 91177308-0d34-0410-b5e6-96231b3b80d8 Tim Shen 3 years ago
6 changed file(s) with 14 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
4444 TargetMachine::CodeGenFileType CGFileType = TargetMachine::CGFT_ObjectFile;
4545 unsigned OptLevel = 2;
4646 bool DisableVerify = false;
47
48 /// Use the new pass manager
49 bool UseNewPM = false;
4750
4851 /// Disable entirely the optimizer, including importing for ThinLTO
4952 bool CodeGenOnly = false;
121121 AddUnsigned(Conf.CGOptLevel);
122122 AddUnsigned(Conf.CGFileType);
123123 AddUnsigned(Conf.OptLevel);
124 AddUnsigned(Conf.UseNewPM);
124125 AddString(Conf.OptPipeline);
125126 AddString(Conf.AAPipeline);
126127 AddString(Conf.OverrideTriple);
4141 using namespace llvm;
4242 using namespace lto;
4343
44 static cl::opt
45 LTOUseNewPM("lto-use-new-pm",
46 cl::desc("Run LTO passes using the new pass manager"),
47 cl::init(false), cl::Hidden);
48
4944 LLVM_ATTRIBUTE_NORETURN static void reportOpenError(StringRef Path, Twine Msg) {
5045 errs() << "failed to open " << Path << ": " << Msg << '\n';
5146 errs().flush();
265260 if (!Conf.OptPipeline.empty())
266261 runNewPMCustomPasses(Mod, TM, Conf.OptPipeline, Conf.AAPipeline,
267262 Conf.DisableVerify);
268 else if (LTOUseNewPM)
263 else if (Conf.UseNewPM)
269264 runNewPMPasses(Mod, TM, Conf.OptLevel, IsThinLTO);
270265 else
271266 runOldPMPasses(Conf, Mod, TM, IsThinLTO, ExportSummary, ImportSummary);
0 ; RUN: opt -module-summary %s -o %t1.bc
11 ; RUN: llvm-lto2 run %t1.bc -o %t.o \
22 ; RUN: -r=%t1.bc,_tinkywinky,pxl \
3 ; RUN: -lto-use-new-pm
3 ; RUN: -use-new-pm
44
55 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
66 target triple = "x86_64-apple-macosx10.11.0"
77
88 ; Try the new pass manager LTO default pipeline (make sure the option
99 ; is accepted).
10 ; RUN: llvm-lto2 run %t1.bc -o %t.o -lto-use-new-pm -r %t1.bc,patatino,px
10 ; RUN: llvm-lto2 run %t1.bc -o %t.o -use-new-pm -r %t1.bc,patatino,px
1111
1212 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
1313 target triple = "x86_64-unknown-linux-gnu"
9797 "pass-remarks-with-hotness",
9898 cl::desc("Whether to include hotness informations in the remarks.\n"
9999 "Has effect only if -pass-remarks-output is specified."));
100
101 static cl::opt
102 UseNewPM("use-new-pm",
103 cl::desc("Run LTO passes using the new pass manager"),
104 cl::init(false), cl::Hidden);
100105
101106 static void check(Error E, std::string Msg) {
102107 if (!E)
195200 Conf.AAPipeline = AAPipeline;
196201
197202 Conf.OptLevel = OptLevel - '0';
203 Conf.UseNewPM = UseNewPM;
198204 switch (CGOptLevel) {
199205 case '0':
200206 Conf.CGOptLevel = CodeGenOpt::None;
350356
351357 // FIXME: This should use llvm::cl subcommands, but it isn't currently
352358 // possible to pass an argument not associated with a subcommand to a
353 // subcommand (e.g. -lto-use-new-pm).
359 // subcommand (e.g. -use-new-pm).
354360 if (argc < 2)
355361 return usage();
356362