@@ -38,6 +38,10 @@ llvm::cl::opt<bool> EnableSILInliningOfGenerics(
38
38
" sil-inline-generics" , llvm::cl::init(false ),
39
39
llvm::cl::desc(" Enable inlining of generics" ));
40
40
41
+ llvm::cl::opt<bool >
42
+ EnableSILAgressiveInlining (" sil-agressive-inline" , llvm::cl::init(false ),
43
+ llvm::cl::desc(" Enable agressive inlining" ));
44
+
41
45
// ===----------------------------------------------------------------------===//
42
46
// Performance Inliner
43
47
// ===----------------------------------------------------------------------===//
@@ -105,7 +109,7 @@ class SILPerformanceInliner {
105
109
// / The benefit of inlining an exclusivity-containing callee.
106
110
// / The exclusivity needs to be: dynamic,
107
111
// / has no nested conflict and addresses known storage
108
- ExclusivityBenefit = RemovedCallBenefit + 125 ,
112
+ ExclusivityBenefit = RemovedCallBenefit + 10 ,
109
113
110
114
// / The benefit of inlining class methods with -Osize.
111
115
// / We only inline very small class methods with -Osize.
@@ -321,6 +325,10 @@ bool SILPerformanceInliner::isProfitableToInline(
321
325
// the exclusivity heuristic or not. We can *only* do that
322
326
// if AllAccessesBeneficialToInline is true
323
327
int ExclusivityBenefitWeight = 0 ;
328
+ int ExclusivityBenefitBase = ExclusivityBenefit;
329
+ if (EnableSILAgressiveInlining) {
330
+ ExclusivityBenefitBase += 500 ;
331
+ }
324
332
325
333
SubstitutionMap CalleeSubstMap = AI.getSubstitutionMap ();
326
334
@@ -422,7 +430,8 @@ bool SILPerformanceInliner::isProfitableToInline(
422
430
if (BAI->hasNoNestedConflict () &&
423
431
(storage.isUniquelyIdentified () ||
424
432
storage.getKind () == AccessedStorage::Class)) {
425
- BlockW.updateBenefit (ExclusivityBenefitWeight, ExclusivityBenefit);
433
+ BlockW.updateBenefit (ExclusivityBenefitWeight,
434
+ ExclusivityBenefitBase);
426
435
} else {
427
436
AllAccessesBeneficialToInline = false ;
428
437
}
0 commit comments