diff --git a/src/mono/mono/mini/interp/transform.c b/src/mono/mono/mini/interp/transform.c index 96564d986bca9..a007007dfe290 100644 --- a/src/mono/mono/mini/interp/transform.c +++ b/src/mono/mono/mini/interp/transform.c @@ -2867,6 +2867,14 @@ interp_method_check_inlining (TransformData *td, MonoMethod *method, MonoMethodS if (td->prof_coverage) return FALSE; + /* + * doesnotreturn methods are not profitable to inline, since they almost certainly will not + * actually run during normal execution, and if they do they will only run once, so the + * upside to inlining them is effectively zero, and we'd waste time doing the inline + */ + if (has_doesnotreturn_attribute (method)) + return FALSE; + if (!is_metadata_update_disabled () && mono_metadata_update_no_inline (td->method, method)) return FALSE;