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