File tree 2 files changed +13
-6
lines changed
compiler/rustc_middle/src/mir
src/test/run-make-fulldeps/inline-always-many-cgu
2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -107,12 +107,14 @@ impl<'tcx> MonoItem<'tcx> {
107
107
}
108
108
109
109
// Finally, if this is `#[inline(always)]` we're sure to respect
110
- // that with an inline copy per CGU, but otherwise we'll be
111
- // creating one copy of this `#[inline]` function which may
112
- // conflict with upstream crates as it could be an exported
113
- // symbol.
110
+ // that (unless in OptLevel::No) with an inline copy per CGU,
111
+ // but otherwise we'll be creating one copy of this `#[inline]`
112
+ // function which may conflict with upstream crates as it could
113
+ // be an exported symbol.
114
114
match tcx. codegen_fn_attrs ( instance. def_id ( ) ) . inline {
115
- InlineAttr :: Always => InstantiationMode :: LocalCopy ,
115
+ InlineAttr :: Always if tcx. sess . opts . optimize != OptLevel :: No => {
116
+ InstantiationMode :: LocalCopy
117
+ }
116
118
_ => InstantiationMode :: GloballyShared { may_conflict : true } ,
117
119
}
118
120
}
Original file line number Diff line number Diff line change 1
1
-include ../tools.mk
2
2
3
3
all :
4
- $(RUSTC ) foo.rs --emit llvm-ir -C codegen-units=2
4
+ $(RUSTC ) foo.rs --emit llvm-ir -C codegen-units=2 -C opt-level=0
5
+ if ! [cat $( TMPDIR) /* .ll | $( CGREP) -e ' \bcall\b' ]; then \
6
+ echo " not found call instruction when one was expected" ; \
7
+ exit 1; \
8
+ fi
9
+ $(RUSTC ) foo.rs --emit llvm-ir -C codegen-units=2 -C opt-level=1
5
10
if cat $( TMPDIR) /* .ll | $( CGREP) -e ' \bcall\b' ; then \
6
11
echo " found call instruction when one wasn't expected" ; \
7
12
exit 1; \
You can’t perform that action at this time.
0 commit comments