Enable inlining of diverging functions

This commit is contained in:
Ben Kimock 2023-02-24 16:33:22 -05:00
parent 2a628bd99c
commit a98ddb6de1
9 changed files with 557 additions and 7 deletions

View file

@ -424,13 +424,6 @@ impl<'tcx> Inliner<'tcx> {
debug!(" final inline threshold = {}", threshold);
// FIXME: Give a bonus to functions with only a single caller
let diverges = matches!(
callee_body.basic_blocks[START_BLOCK].terminator().kind,
TerminatorKind::Unreachable | TerminatorKind::Call { target: None, .. }
);
if diverges && !matches!(callee_attrs.inline, InlineAttr::Always) {
return Err("callee diverges unconditionally");
}
let mut checker = CostChecker {
tcx: self.tcx,