Skip to content

Commit

Permalink
Auto merge of #126578 - scottmcm:inlining-bonuses-too, r=davidtwco
Browse files Browse the repository at this point in the history
Account for things that optimize out in inlining costs

This updates the MIR inlining `CostChecker` to have both bonuses and penalties, rather than just penalties.

That lets us add bonuses for some things where we want to encourage inlining without risking wrapping into a gigantic cost.  For example, `switchInt(const …)` we give an inlining bonus because codegen will actually eliminate the branch (and associated dead blocks) once it's monomorphized, so measuring both sides of the branch gives an unrealistically-high cost to it.  Similarly, an `unreachable` terminator gets a small bonus, because whatever branch leads there doesn't actually exist post-codegen.
  • Loading branch information
bors committed Jun 21, 2024
2 parents 071ef45 + 400a29d commit 74cf63c
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit 74cf63c

Please sign in to comment.