Skip to content

Commit

Permalink
Don't consider for inlining local functions in debug profile
Browse files Browse the repository at this point in the history
  • Loading branch information
vlad20012 committed Apr 20, 2023
1 parent e65665f commit cd69787
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion compiler/rustc_mir_transform/src/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,13 @@ impl<'tcx> Inliner<'tcx> {
) -> Result<(), &'static str> {
match callee_attrs.inline {
InlineAttr::Never => return Err("never inline hint"),
InlineAttr::Always => {}
InlineAttr::Always => {
if self.tcx.sess.mir_opt_level() == 1 && callsite.callee.def_id().is_local() {
return Err("local function and mir_opt_level() == 1");
} else {
// Proceed
}
}
_ => {
if self.tcx.sess.mir_opt_level() == 1 {
return Err("No inline(always) and mir_opt_level() == 1");
Expand Down

0 comments on commit cd69787

Please sign in to comment.