File tree Expand file tree Collapse file tree 4 files changed +54
-0
lines changed Expand file tree Collapse file tree 4 files changed +54
-0
lines changed Original file line number Diff line number Diff line change @@ -1511,6 +1511,41 @@ Expected<bool> parseVirtRegRewriterPassOptions(StringRef Params) {
1511
1511
return ClearVirtRegs;
1512
1512
}
1513
1513
1514
+ struct FatLTOOptions {
1515
+ OptimizationLevel OptLevel;
1516
+ bool ThinLTO = false ;
1517
+ bool EmitSummary = false ;
1518
+ };
1519
+
1520
+ Expected<FatLTOOptions> parseFatLTOOptions (StringRef Params) {
1521
+ FatLTOOptions Result;
1522
+ bool HaveOptLevel = false ;
1523
+ while (!Params.empty ()) {
1524
+ StringRef ParamName;
1525
+ std::tie (ParamName, Params) = Params.split (' ;' );
1526
+
1527
+ if (ParamName == " thinlto" ) {
1528
+ Result.ThinLTO = true ;
1529
+ } else if (ParamName == " emit-summary" ) {
1530
+ Result.EmitSummary = true ;
1531
+ } else if (std::optional<OptimizationLevel> OptLevel =
1532
+ parseOptLevel (ParamName)) {
1533
+ Result.OptLevel = *OptLevel;
1534
+ HaveOptLevel = true ;
1535
+ } else {
1536
+ return make_error<StringError>(
1537
+ formatv (" invalid fatlto-pre-link pass parameter '{}'" , ParamName)
1538
+ .str (),
1539
+ inconvertibleErrorCode ());
1540
+ }
1541
+ }
1542
+ if (!HaveOptLevel)
1543
+ return make_error<StringError>(
1544
+ " missing optimization level for fatlto-pre-link pipeline" ,
1545
+ inconvertibleErrorCode ());
1546
+ return Result;
1547
+ }
1548
+
1514
1549
} // namespace
1515
1550
1516
1551
// / Tests whether registered callbacks will accept a given pass name.
Original file line number Diff line number Diff line change @@ -276,6 +276,13 @@ MODULE_PASS_WITH_PARAMS(
276
276
return buildLTODefaultPipeline (L, nullptr );
277
277
},
278
278
parseOptLevelParam, " O0;O1;O2;O3;Os;Oz" )
279
+ MODULE_PASS_WITH_PARAMS (
280
+ " fatlto-pre-link" , " " , [&](FatLTOOptions Opts) {
281
+ setupOptionsForPipelineAlias (PTO, Opts.OptLevel );
282
+ return buildFatLTODefaultPipeline (Opts.OptLevel , Opts.ThinLTO ,
283
+ Opts.EmitSummary );
284
+ },
285
+ parseFatLTOOptions, " O0;O1;O2;O3;Os;Oz;thinlto;emit-summary" )
279
286
280
287
#undef MODULE_PASS_WITH_PARAMS
281
288
Original file line number Diff line number Diff line change
1
+ ; RUN: opt -debug-pass-manager -passes='fatlto-pre-link<O2>' %s 2>&1 | FileCheck %s
2
+ ; RUN: opt -debug-pass-manager -passes='fatlto-pre-link<O2;thinlto>' %s 2>&1 | FileCheck %s --check-prefixes=CHECK,THINLTO
3
+
4
+ ; CHECK: Running pass: EmbedBitcodePass on [module]
5
+ ; THINLTO: Running analysis: ProfileSummaryAnalysis on [module]
6
+ ; CHECK-NEXT: Running pass: FatLtoCleanup on [module]
7
+ ; CHECK-NEXT: Running pass: LowerTypeTestsPass on [module]
Original file line number Diff line number Diff line change 8
8
; RUN: not opt -passes="lto-pre-link<foo>" < %s 2>&1 | FileCheck %s --check-prefix=INVALID-OPT-LEVEL
9
9
; RUN: not opt -passes="lto" < %s 2>&1 | FileCheck %s --check-prefix=MISSING-OPT-LEVEL
10
10
; RUN: not opt -passes="lto<foo>" < %s 2>&1 | FileCheck %s --check-prefix=INVALID-OPT-LEVEL
11
+ ; RUN: not opt -passes="fatlto-pre-link" < %s 2>&1 | FileCheck %s --check-prefix=FATLTO-MISSING-OPT-LEVEL
12
+ ; RUN: not opt -passes="fatlto-pre-link<foo>" < %s 2>&1 | FileCheck %s --check-prefix=FATLTO-INVALID-PARAMS
11
13
12
14
; MISSING-OPT-LEVEL: invalid optimization level ''
13
15
; INVALID-OPT-LEVEL: invalid optimization level 'foo'
16
+
17
+ ; FATLTO-MISSING-OPT-LEVEL: missing optimization level for fatlto-pre-link pipeline
18
+ ; FATLTO-INVALID-PARAMS: invalid fatlto-pre-link pass parameter 'foo'
You can’t perform that action at this time.
0 commit comments