mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SILInliner: Critical edges have no code size impact.
I think unconditional branches should be free, period. They will mostly be removed during LLVM code gen. However, fixing this requires signficant adjustments to inlining heuristics to avoid microbenchmark regressions at -Osize. So, instead I am just making this less sensitive to critical edges for the sake of pipeline stability.
This commit is contained in:
@@ -790,6 +790,11 @@ InlineCost swift::instructionInlineCost(SILInstruction &I) {
|
||||
case SILInstructionKind::GetAsyncContinuationInst:
|
||||
return InlineCost::Free;
|
||||
|
||||
// Unconditional branch is free in empty blocks.
|
||||
case SILInstructionKind::BranchInst:
|
||||
return (I.getIterator() == I.getParent()->begin())
|
||||
? InlineCost::Free : InlineCost::Expensive;
|
||||
|
||||
case SILInstructionKind::AbortApplyInst:
|
||||
case SILInstructionKind::ApplyInst:
|
||||
case SILInstructionKind::TryApplyInst:
|
||||
@@ -804,7 +809,6 @@ InlineCost swift::instructionInlineCost(SILInstruction &I) {
|
||||
case SILInstructionKind::WitnessMethodInst:
|
||||
case SILInstructionKind::AssignInst:
|
||||
case SILInstructionKind::AssignByWrapperInst:
|
||||
case SILInstructionKind::BranchInst:
|
||||
case SILInstructionKind::CheckedCastBranchInst:
|
||||
case SILInstructionKind::CheckedCastValueBranchInst:
|
||||
case SILInstructionKind::CheckedCastAddrBranchInst:
|
||||
|
||||
Reference in New Issue
Block a user