File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed
compiler/rustc_middle/src/mir
src/test/run-make-fulldeps/inline-always-many-cgu Expand file tree Collapse file tree 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> {
107107 }
108108
109109 // 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.
114114 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+ }
116118 _ => InstantiationMode :: GloballyShared { may_conflict : true } ,
117119 }
118120 }
Original file line number Diff line number Diff line change 11-include ../tools.mk
22
33all :
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
510 if cat $( TMPDIR) /* .ll | $( CGREP) -e ' \bcall\b' ; then \
611 echo " found call instruction when one wasn't expected" ; \
712 exit 1; \
You can’t perform that action at this time.
0 commit comments