File tree 1 file changed +11
-10
lines changed
compiler/rustc_middle/src/mir
1 file changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -78,14 +78,6 @@ impl<'tcx> MonoItem<'tcx> {
78
78
}
79
79
80
80
pub fn instantiation_mode ( & self , tcx : TyCtxt < ' tcx > ) -> InstantiationMode {
81
- let generate_cgu_internal_copies = tcx
82
- . sess
83
- . opts
84
- . debugging_opts
85
- . inline_in_all_cgus
86
- . unwrap_or_else ( || tcx. sess . opts . optimize != OptLevel :: No )
87
- && !tcx. sess . link_dead_code ( ) ;
88
-
89
81
match * self {
90
82
MonoItem :: Fn ( ref instance) => {
91
83
let entry_def_id = tcx. entry_fn ( LOCAL_CRATE ) . map ( |( id, _) | id) ;
@@ -98,9 +90,18 @@ impl<'tcx> MonoItem<'tcx> {
98
90
return InstantiationMode :: GloballyShared { may_conflict : false } ;
99
91
}
100
92
93
+ let generate_cgu_internal_copies = tcx
94
+ . sess
95
+ . opts
96
+ . debugging_opts
97
+ . inline_in_all_cgus
98
+ . unwrap_or_else ( || tcx. sess . opts . optimize != OptLevel :: No )
99
+ && !tcx. sess . link_dead_code ( ) ;
100
+
101
101
// At this point we don't have explicit linkage and we're an
102
- // inlined function. If we're inlining into all CGUs then we'll
103
- // be creating a local copy per CGU.
102
+ // inlined function. If we should generate local copies for each CGU,
103
+ // then return `LocalCopy`, otherwise we'll just generate one copy
104
+ // and share it with all CGUs in this crate.
104
105
if generate_cgu_internal_copies {
105
106
InstantiationMode :: LocalCopy
106
107
} else {
You can’t perform that action at this time.
0 commit comments