forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#78966 - tmiasko:inline-never, r=oli-obk
Never inline C variadics, cold functions, functions with incompatible attributes ... ... and fix generator inlining. Closes rust-lang#67863. Closes rust-lang#78859.
- Loading branch information
Showing
9 changed files
with
238 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// ignore-wasm32-bare compiled with panic=abort by default | ||
#![feature(generators, generator_trait)] | ||
|
||
use std::ops::Generator; | ||
use std::pin::Pin; | ||
|
||
// EMIT_MIR inline_generator.main.Inline.diff | ||
fn main() { | ||
let _r = Pin::new(&mut g()).resume(false); | ||
} | ||
|
||
#[inline(always)] | ||
pub fn g() -> impl Generator<bool> { | ||
#[inline(always)] | ||
|a| { yield if a { 7 } else { 13 } } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/test/mir-opt/inline/inline_compatibility.not_inlined_c_variadic.Inline.diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
- // MIR for `not_inlined_c_variadic` before Inline | ||
+ // MIR for `not_inlined_c_variadic` after Inline | ||
|
||
fn not_inlined_c_variadic() -> () { | ||
let mut _0: (); // return place in scope 0 at $DIR/inline-compatibility.rs:41:40: 41:40 | ||
let _1: u32; // in scope 0 at $DIR/inline-compatibility.rs:42:9: 42:10 | ||
scope 1 { | ||
debug s => _1; // in scope 1 at $DIR/inline-compatibility.rs:42:9: 42:10 | ||
} | ||
|
||
bb0: { | ||
StorageLive(_1); // scope 0 at $DIR/inline-compatibility.rs:42:9: 42:10 | ||
_1 = sum(const 4_u32, const 4_u32, const 30_u32, const 200_u32, const 1000_u32) -> bb1; // scope 0 at $DIR/inline-compatibility.rs:42:13: 42:52 | ||
// mir::Constant | ||
// + span: $DIR/inline-compatibility.rs:42:13: 42:16 | ||
// + literal: Const { ty: unsafe extern "C" fn(u32, ...) -> u32 {sum}, val: Value(Scalar(<ZST>)) } | ||
} | ||
|
||
bb1: { | ||
_0 = const (); // scope 0 at $DIR/inline-compatibility.rs:41:40: 43:2 | ||
StorageDead(_1); // scope 0 at $DIR/inline-compatibility.rs:43:1: 43:2 | ||
return; // scope 0 at $DIR/inline-compatibility.rs:43:2: 43:2 | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.