@@ -91,10 +91,9 @@ impl<'tcx> MonoItem<'tcx> {
91
91
match * self {
92
92
MonoItem :: Fn ( ref instance) => {
93
93
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 ( )
98
97
|| !instance. def . generates_cgu_internal_copy ( tcx)
99
98
|| Some ( instance. def_id ( ) ) == entry_def_id. map ( LocalDefId :: to_def_id)
100
99
{
@@ -103,12 +102,8 @@ impl<'tcx> MonoItem<'tcx> {
103
102
104
103
// At this point we don't have explicit linkage and we're an
105
104
// 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 {
112
107
return InstantiationMode :: LocalCopy ;
113
108
}
114
109
0 commit comments