@@ -91,10 +91,9 @@ impl<'tcx> MonoItem<'tcx> {
9191 match * self {
9292 MonoItem :: Fn ( ref instance) => {
9393 let entry_def_id = tcx. entry_fn ( LOCAL_CRATE ) . map ( |( id, _) | id) ;
94- // If this function isn't inlined or otherwise has explicit
95- // linkage or an extern indicator, then we'll be creating a
96- // globally shared version.
97- if self . explicit_linkage ( tcx) . is_some ( )
94+ // If this function isn't inlined or otherwise has an extern
95+ // indicator, then we'll be creating a globally shared version.
96+ if tcx. codegen_fn_attrs ( instance. def_id ( ) ) . contains_extern_indicator ( )
9897 || !instance. def . generates_cgu_internal_copy ( tcx)
9998 || Some ( instance. def_id ( ) ) == entry_def_id. map ( LocalDefId :: to_def_id)
10099 {
@@ -103,12 +102,8 @@ impl<'tcx> MonoItem<'tcx> {
103102
104103 // At this point we don't have explicit linkage and we're an
105104 // inlined function. If we're inlining into all CGUs then we'll
106- // be creating a local copy per CGU. We need to watch out here
107- // for an extern indicator as we don't want to optimise away
108- // inlined functions that should be exported.
109- if generate_cgu_internal_copies
110- && !tcx. codegen_fn_attrs ( instance. def_id ( ) ) . contains_extern_indicator ( )
111- {
105+ // be creating a local copy per CGU.
106+ if generate_cgu_internal_copies {
112107 return InstantiationMode :: LocalCopy ;
113108 }
114109
0 commit comments