mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-12 20:16:49 +00:00
Permit MIR inlining without #[inline]
This commit is contained in:
parent
da636956dd
commit
e3126b1084
@ -350,14 +350,8 @@ impl<'tcx> Inliner<'tcx> {
|
||||
callsite: &CallSite<'tcx>,
|
||||
callee_attrs: &CodegenFnAttrs,
|
||||
) -> Result<(), &'static str> {
|
||||
match callee_attrs.inline {
|
||||
InlineAttr::Never => return Err("never inline hint"),
|
||||
InlineAttr::Always | InlineAttr::Hint => {}
|
||||
InlineAttr::None => {
|
||||
if self.tcx.sess.mir_opt_level() <= 2 {
|
||||
return Err("at mir-opt-level=2, only #[inline] is inlined");
|
||||
}
|
||||
}
|
||||
if let InlineAttr::Never = callee_attrs.inline {
|
||||
return Err("never inline hint");
|
||||
}
|
||||
|
||||
// Only inline local functions if they would be eligible for cross-crate
|
||||
|
@ -21,7 +21,7 @@ pub fn short_integer_map(x: [u32; 8]) -> [u32; 8] {
|
||||
pub fn short_integer_zip_map(x: [u32; 8], y: [u32; 8]) -> [u32; 8] {
|
||||
// CHECK: %[[A:.+]] = load <8 x i32>
|
||||
// CHECK: %[[B:.+]] = load <8 x i32>
|
||||
// CHECK: sub <8 x i32> %[[A]], %[[B]]
|
||||
// CHECK: sub <8 x i32> %[[B]], %[[A]]
|
||||
// CHECK: store <8 x i32>
|
||||
x.zip(y).map(|(x, y)| x - y)
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Checks that closures, constructors, and shims except
|
||||
// for a drop glue receive inline hint by default.
|
||||
//
|
||||
// compile-flags: -Cno-prepopulate-passes -Csymbol-mangling-version=v0
|
||||
// compile-flags: -Cno-prepopulate-passes -Csymbol-mangling-version=v0 -Zinline-mir=no
|
||||
#![crate_type = "lib"]
|
||||
|
||||
pub fn f() {
|
||||
|
@ -1,4 +1,4 @@
|
||||
// compile-flags: -C no-prepopulate-passes -Zshare-generics=yes
|
||||
// compile-flags: -C no-prepopulate-passes -Zshare-generics=yes -Zinline-mir=no
|
||||
|
||||
// Check that local generics are internalized if they are in the same CGU
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user