diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-11-26 10:39:10 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-26 10:39:10 +0100 |
| commit | 4733312e09c04fec3626ea27083da615d1a1df4d (patch) | |
| tree | 9a8f2196f26457972c8c84f77c7f13ce39c98d2b /src/test/mir-opt/inline/inline_instruction_set.default.Inline.diff | |
| parent | f8a2e491ebec34113563cf8683f6fec2646cebb1 (diff) | |
| parent | ea4794321224964060b931d962a9a6ee7e59ac7c (diff) | |
| download | rust-4733312e09c04fec3626ea27083da615d1a1df4d.tar.gz rust-4733312e09c04fec3626ea27083da615d1a1df4d.zip | |
Rollup merge of #104121 - Lokathor:mir-opt-when-instruction-set-missing-on-callee, r=tmiasko
Refine `instruction_set` MIR inline rules Previously an exact match of the `instruction_set` attribute was required for an MIR inline to be considered. This change checks for an exact match *only* if the callee sets an `instruction_set` in the first place. When the callee does not declare an instruction set then it is considered to be platform agnostic code and it's allowed to be inline'd into the caller. cc ``@oli-obk`` [Edit] Zulip Context: https://rust-lang.zulipchat.com/#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/What.20exactly.20does.20the.20MIR.20optimizer.20do.3F
Diffstat (limited to 'src/test/mir-opt/inline/inline_instruction_set.default.Inline.diff')
| -rw-r--r-- | src/test/mir-opt/inline/inline_instruction_set.default.Inline.diff | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/src/test/mir-opt/inline/inline_instruction_set.default.Inline.diff b/src/test/mir-opt/inline/inline_instruction_set.default.Inline.diff index e421428dcdf..f1988ea4bd6 100644 --- a/src/test/mir-opt/inline/inline_instruction_set.default.Inline.diff +++ b/src/test/mir-opt/inline/inline_instruction_set.default.Inline.diff @@ -6,14 +6,19 @@ let _1: (); // in scope 0 at $DIR/inline_instruction_set.rs:+1:5: +1:26 let _2: (); // in scope 0 at $DIR/inline_instruction_set.rs:+2:5: +2:26 let _3: (); // in scope 0 at $DIR/inline_instruction_set.rs:+3:5: +3:30 -+ scope 1 (inlined instruction_set_default) { // at $DIR/inline_instruction_set.rs:53:5: 53:30 + let _4: (); // in scope 0 at $DIR/inline_instruction_set.rs:+4:5: +4:41 ++ scope 1 (inlined instruction_set_default) { // at $DIR/inline_instruction_set.rs:59:5: 59:30 ++ } ++ scope 2 (inlined inline_always_and_using_inline_asm) { // at $DIR/inline_instruction_set.rs:60:5: 60:41 ++ scope 3 { ++ } + } bb0: { StorageLive(_1); // scope 0 at $DIR/inline_instruction_set.rs:+1:5: +1:26 _1 = instruction_set_a32() -> bb1; // scope 0 at $DIR/inline_instruction_set.rs:+1:5: +1:26 // mir::Constant - // + span: $DIR/inline_instruction_set.rs:51:5: 51:24 + // + span: $DIR/inline_instruction_set.rs:57:5: 57:24 // + literal: Const { ty: fn() {instruction_set_a32}, val: Value(<ZST>) } } @@ -22,7 +27,7 @@ StorageLive(_2); // scope 0 at $DIR/inline_instruction_set.rs:+2:5: +2:26 _2 = instruction_set_t32() -> bb2; // scope 0 at $DIR/inline_instruction_set.rs:+2:5: +2:26 // mir::Constant - // + span: $DIR/inline_instruction_set.rs:52:5: 52:24 + // + span: $DIR/inline_instruction_set.rs:58:5: 58:24 // + literal: Const { ty: fn() {instruction_set_t32}, val: Value(<ZST>) } } @@ -31,14 +36,25 @@ StorageLive(_3); // scope 0 at $DIR/inline_instruction_set.rs:+3:5: +3:30 - _3 = instruction_set_default() -> bb3; // scope 0 at $DIR/inline_instruction_set.rs:+3:5: +3:30 - // mir::Constant -- // + span: $DIR/inline_instruction_set.rs:53:5: 53:28 +- // + span: $DIR/inline_instruction_set.rs:59:5: 59:28 - // + literal: Const { ty: fn() {instruction_set_default}, val: Value(<ZST>) } - } - - bb3: { StorageDead(_3); // scope 0 at $DIR/inline_instruction_set.rs:+3:30: +3:31 - _0 = const (); // scope 0 at $DIR/inline_instruction_set.rs:+0:18: +4:2 - return; // scope 0 at $DIR/inline_instruction_set.rs:+4:2: +4:2 + StorageLive(_4); // scope 0 at $DIR/inline_instruction_set.rs:+4:5: +4:41 +- _4 = inline_always_and_using_inline_asm() -> bb4; // scope 0 at $DIR/inline_instruction_set.rs:+4:5: +4:41 +- // mir::Constant +- // + span: $DIR/inline_instruction_set.rs:60:5: 60:39 +- // + literal: Const { ty: fn() {inline_always_and_using_inline_asm}, val: Value(<ZST>) } ++ asm!("/* do nothing */", options((empty))) -> bb3; // scope 3 at $DIR/inline_instruction_set.rs:43:14: 43:38 + } + +- bb4: { ++ bb3: { + StorageDead(_4); // scope 0 at $DIR/inline_instruction_set.rs:+4:41: +4:42 + _0 = const (); // scope 0 at $DIR/inline_instruction_set.rs:+0:18: +5:2 + return; // scope 0 at $DIR/inline_instruction_set.rs:+5:2: +5:2 } } |
