Auto merge of #70721 - anyska:bless-all-mir-opt, r=oli-obk
--bless all mir-opt tests. r? @oli-obk
This commit is contained in:
commit
1edcfc83c6
208 changed files with 10198 additions and 4304 deletions
|
@ -1,9 +1,7 @@
|
|||
This folder contains tests for MIR optimizations.
|
||||
|
||||
There are two test formats. One allows specifying a pattern to look for in the MIR, which also
|
||||
permits leaving placeholders, but requires you to manually change the pattern if anything changes.
|
||||
The other emits MIR to extra files that you can automatically update by specifying `--bless` on
|
||||
the command line (just like `ui` tests updating `.stderr` files).
|
||||
The `mir-opt` test format emits MIR to extra files that you can automatically update by specifying
|
||||
`--bless` on the command line (just like `ui` tests updating `.stderr` files).
|
||||
|
||||
# `--bless`able test format
|
||||
|
||||
|
@ -39,79 +37,3 @@ This exists mainly for completeness and is rarely useful.
|
|||
```
|
||||
// EMIT_MIR $file_name_of_some_mir_dump.before.mir
|
||||
```
|
||||
|
||||
# Inline test format
|
||||
|
||||
```
|
||||
(arbitrary rust code)
|
||||
// END RUST SOURCE
|
||||
// START $file_name_of_some_mir_dump_0
|
||||
// $expected_line_0
|
||||
// (lines or elision)
|
||||
// $expected_line_N
|
||||
// END $file_name_of_some_mir_dump_0
|
||||
// (lines or elision)
|
||||
// START $file_name_of_some_mir_dump_N
|
||||
// $expected_line_0
|
||||
// (lines or elision)
|
||||
// $expected_line_N
|
||||
// END $file_name_of_some_mir_dump_N
|
||||
```
|
||||
|
||||
All the test information is in comments so the test is runnable.
|
||||
|
||||
For each $file_name, compiletest expects [$expected_line_0, ...,
|
||||
$expected_line_N] to appear in the dumped MIR in order. Currently it allows
|
||||
other non-matched lines before and after, but not between $expected_lines,
|
||||
should you want to skip lines, you must include an elision comment, of the form
|
||||
(as a regex) `//\s*...\s*`. The lines will be skipped lazily, that is, if there
|
||||
are two identical lines in the output that match the line after the elision
|
||||
comment, the first one will be matched.
|
||||
|
||||
Examples:
|
||||
|
||||
The following blocks will not match the one after it.
|
||||
|
||||
```
|
||||
bb0: {
|
||||
StorageLive(_1);
|
||||
_1 = const true;
|
||||
StorageDead(_1);
|
||||
}
|
||||
```
|
||||
|
||||
```
|
||||
bb0: {
|
||||
StorageLive(_1);
|
||||
_1 = const true;
|
||||
goto -> bb1
|
||||
}
|
||||
bb1: {
|
||||
StorageDead(_1);
|
||||
return;
|
||||
}
|
||||
```
|
||||
|
||||
But this will match the one above,
|
||||
|
||||
```
|
||||
bb0: {
|
||||
StorageLive(_1);
|
||||
_1 = const true;
|
||||
...
|
||||
StorageDead(_1);
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
Lines match ignoring whitespace, and the prefix "//" is removed.
|
||||
|
||||
It also currently strips trailing comments -- partly because the full file path
|
||||
in "scope comments" is unpredictable and partly because tidy complains about
|
||||
the lines being too long.
|
||||
|
||||
compiletest handles dumping the MIR before and after every pass for you. The
|
||||
test writer only has to specify the file names of the dumped files (not the
|
||||
full path to the file) and what lines to expect. There is an option to rustc
|
||||
that tells it to dump the mir into some directly (rather then always dumping to
|
||||
the current directory).
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// EMIT_MIR rustc.address_of_reborrow.SimplifyCfg-initial.after.mir
|
||||
|
||||
fn address_of_reborrow() {
|
||||
let y = &[0; 10];
|
||||
let mut z = &mut [0; 10];
|
||||
|
@ -35,6 +37,7 @@ fn address_of_reborrow() {
|
|||
}
|
||||
|
||||
// The normal borrows here should be preserved
|
||||
// EMIT_MIR rustc.borrow_and_cast.SimplifyCfg-initial.after.mir
|
||||
fn borrow_and_cast(mut x: i32) {
|
||||
let p = &x as *const i32;
|
||||
let q = &mut x as *const i32;
|
||||
|
@ -42,71 +45,3 @@ fn borrow_and_cast(mut x: i32) {
|
|||
}
|
||||
|
||||
fn main() {}
|
||||
|
||||
// START rustc.address_of_reborrow.SimplifyCfg-initial.after.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _5 = &raw const (*_1); // & to *const casts
|
||||
// ...
|
||||
// _7 = &raw const (*_1);
|
||||
// ...
|
||||
// _11 = &raw const (*_1);
|
||||
// ...
|
||||
// _14 = &raw const (*_1);
|
||||
// ...
|
||||
// _16 = &raw const (*_1);
|
||||
// ...
|
||||
// _17 = &raw const (*_1); // & to *const coercions
|
||||
// ...
|
||||
// _18 = &raw const (*_1);
|
||||
// ...
|
||||
// _20 = &raw const (*_1);
|
||||
// ...
|
||||
// _22 = &raw const (*_1);
|
||||
// ...
|
||||
// _24 = &raw const (*_2); // &mut to *const casts
|
||||
// ...
|
||||
// _26 = &raw const (*_2);
|
||||
// ...
|
||||
// _30 = &raw const (*_2);
|
||||
// ...
|
||||
// _33 = &raw const (*_2);
|
||||
// ...
|
||||
// _34 = &raw const (*_2); // &mut to *const coercions
|
||||
// ...
|
||||
// _35 = &raw const (*_2);
|
||||
// ...
|
||||
// _37 = &raw const (*_2);
|
||||
// ...
|
||||
// _39 = &raw const (*_2);
|
||||
// ...
|
||||
// _41 = &raw mut (*_2); // &mut to *mut casts
|
||||
// ...
|
||||
// _43 = &raw mut (*_2);
|
||||
// ...
|
||||
// _47 = &raw mut (*_2);
|
||||
// ...
|
||||
// _50 = &raw mut (*_2);
|
||||
// ...
|
||||
// _51 = &raw mut (*_2); // &mut to *mut coercions
|
||||
// ...
|
||||
// _52 = &raw mut (*_2);
|
||||
// ...
|
||||
// _54 = &raw mut (*_2);
|
||||
// ...
|
||||
// _56 = &raw mut (*_2);
|
||||
// ...
|
||||
// }
|
||||
// END rustc.address_of_reborrow.SimplifyCfg-initial.after.mir
|
||||
|
||||
// START rustc.borrow_and_cast.EraseRegions.after.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _4 = &_1;
|
||||
// ...
|
||||
// _7 = &mut _1;
|
||||
// ...
|
||||
// _10 = &mut _1;
|
||||
// ...
|
||||
// }
|
||||
// END rustc.borrow_and_cast.EraseRegions.after.mir
|
||||
|
|
|
@ -0,0 +1,320 @@
|
|||
// MIR for `address_of_reborrow` after SimplifyCfg-initial
|
||||
|
||||
| User Type Annotations
|
||||
| 0: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }], value: Ty(*const ^0) } at $DIR/address-of.rs:7:5: 7:18
|
||||
| 1: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }], value: Ty(*const dyn std::marker::Send) } at $DIR/address-of.rs:9:5: 9:25
|
||||
| 2: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }], value: Ty(*const ^0) } at $DIR/address-of.rs:13:12: 13:20
|
||||
| 3: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }], value: Ty(*const ^0) } at $DIR/address-of.rs:13:12: 13:20
|
||||
| 4: Canonical { max_universe: U0, variables: [], value: Ty(*const [i32; 10]) } at $DIR/address-of.rs:14:12: 14:28
|
||||
| 5: Canonical { max_universe: U0, variables: [], value: Ty(*const [i32; 10]) } at $DIR/address-of.rs:14:12: 14:28
|
||||
| 6: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }], value: Ty(*const dyn std::marker::Send) } at $DIR/address-of.rs:15:12: 15:27
|
||||
| 7: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }], value: Ty(*const dyn std::marker::Send) } at $DIR/address-of.rs:15:12: 15:27
|
||||
| 8: Canonical { max_universe: U0, variables: [], value: Ty(*const [i32]) } at $DIR/address-of.rs:16:12: 16:24
|
||||
| 9: Canonical { max_universe: U0, variables: [], value: Ty(*const [i32]) } at $DIR/address-of.rs:16:12: 16:24
|
||||
| 10: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }], value: Ty(*const ^0) } at $DIR/address-of.rs:18:5: 18:18
|
||||
| 11: Canonical { max_universe: U3, variables: [CanonicalVarInfo { kind: Region(U3) }], value: Ty(*const dyn std::marker::Send) } at $DIR/address-of.rs:20:5: 20:25
|
||||
| 12: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }], value: Ty(*const ^0) } at $DIR/address-of.rs:23:12: 23:20
|
||||
| 13: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }], value: Ty(*const ^0) } at $DIR/address-of.rs:23:12: 23:20
|
||||
| 14: Canonical { max_universe: U0, variables: [], value: Ty(*const [i32; 10]) } at $DIR/address-of.rs:24:12: 24:28
|
||||
| 15: Canonical { max_universe: U0, variables: [], value: Ty(*const [i32; 10]) } at $DIR/address-of.rs:24:12: 24:28
|
||||
| 16: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }], value: Ty(*const dyn std::marker::Send) } at $DIR/address-of.rs:25:12: 25:27
|
||||
| 17: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }], value: Ty(*const dyn std::marker::Send) } at $DIR/address-of.rs:25:12: 25:27
|
||||
| 18: Canonical { max_universe: U0, variables: [], value: Ty(*const [i32]) } at $DIR/address-of.rs:26:12: 26:24
|
||||
| 19: Canonical { max_universe: U0, variables: [], value: Ty(*const [i32]) } at $DIR/address-of.rs:26:12: 26:24
|
||||
| 20: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }], value: Ty(*mut ^0) } at $DIR/address-of.rs:28:5: 28:16
|
||||
| 21: Canonical { max_universe: U6, variables: [CanonicalVarInfo { kind: Region(U6) }], value: Ty(*mut dyn std::marker::Send) } at $DIR/address-of.rs:30:5: 30:23
|
||||
| 22: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }], value: Ty(*mut ^0) } at $DIR/address-of.rs:33:12: 33:18
|
||||
| 23: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }], value: Ty(*mut ^0) } at $DIR/address-of.rs:33:12: 33:18
|
||||
| 24: Canonical { max_universe: U0, variables: [], value: Ty(*mut [i32; 10]) } at $DIR/address-of.rs:34:12: 34:26
|
||||
| 25: Canonical { max_universe: U0, variables: [], value: Ty(*mut [i32; 10]) } at $DIR/address-of.rs:34:12: 34:26
|
||||
| 26: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }], value: Ty(*mut dyn std::marker::Send) } at $DIR/address-of.rs:35:12: 35:25
|
||||
| 27: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }], value: Ty(*mut dyn std::marker::Send) } at $DIR/address-of.rs:35:12: 35:25
|
||||
| 28: Canonical { max_universe: U0, variables: [], value: Ty(*mut [i32]) } at $DIR/address-of.rs:36:12: 36:22
|
||||
| 29: Canonical { max_universe: U0, variables: [], value: Ty(*mut [i32]) } at $DIR/address-of.rs:36:12: 36:22
|
||||
|
|
||||
fn address_of_reborrow() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/address-of.rs:3:26: 3:26
|
||||
let _1: &[i32; 10]; // in scope 0 at $DIR/address-of.rs:4:9: 4:10
|
||||
let _2: [i32; 10]; // in scope 0 at $DIR/address-of.rs:4:14: 4:21
|
||||
let mut _4: [i32; 10]; // in scope 0 at $DIR/address-of.rs:5:22: 5:29
|
||||
let _5: *const [i32; 10]; // in scope 0 at $DIR/address-of.rs:7:5: 7:18
|
||||
let mut _6: *const [i32; 10]; // in scope 0 at $DIR/address-of.rs:7:5: 7:18
|
||||
let _7: *const [i32; 10]; // in scope 0 at $DIR/address-of.rs:8:5: 8:26
|
||||
let _8: *const dyn std::marker::Send; // in scope 0 at $DIR/address-of.rs:9:5: 9:25
|
||||
let mut _9: *const dyn std::marker::Send; // in scope 0 at $DIR/address-of.rs:9:5: 9:25
|
||||
let mut _10: *const [i32; 10]; // in scope 0 at $DIR/address-of.rs:9:5: 9:6
|
||||
let _11: *const [i32]; // in scope 0 at $DIR/address-of.rs:10:5: 10:22
|
||||
let mut _12: *const [i32; 10]; // in scope 0 at $DIR/address-of.rs:10:5: 10:6
|
||||
let _13: *const i32; // in scope 0 at $DIR/address-of.rs:11:5: 11:20
|
||||
let mut _14: *const [i32; 10]; // in scope 0 at $DIR/address-of.rs:11:5: 11:6
|
||||
let mut _18: *const [i32; 10]; // in scope 0 at $DIR/address-of.rs:15:30: 15:31
|
||||
let mut _20: *const [i32; 10]; // in scope 0 at $DIR/address-of.rs:16:27: 16:28
|
||||
let _21: *const [i32; 10]; // in scope 0 at $DIR/address-of.rs:18:5: 18:18
|
||||
let mut _22: *const [i32; 10]; // in scope 0 at $DIR/address-of.rs:18:5: 18:18
|
||||
let _23: *const [i32; 10]; // in scope 0 at $DIR/address-of.rs:19:5: 19:26
|
||||
let _24: *const dyn std::marker::Send; // in scope 0 at $DIR/address-of.rs:20:5: 20:25
|
||||
let mut _25: *const dyn std::marker::Send; // in scope 0 at $DIR/address-of.rs:20:5: 20:25
|
||||
let mut _26: *const [i32; 10]; // in scope 0 at $DIR/address-of.rs:20:5: 20:6
|
||||
let _27: *const [i32]; // in scope 0 at $DIR/address-of.rs:21:5: 21:22
|
||||
let mut _28: *const [i32; 10]; // in scope 0 at $DIR/address-of.rs:21:5: 21:6
|
||||
let mut _32: *const [i32; 10]; // in scope 0 at $DIR/address-of.rs:25:30: 25:31
|
||||
let mut _34: *const [i32; 10]; // in scope 0 at $DIR/address-of.rs:26:27: 26:28
|
||||
let _35: *mut [i32; 10]; // in scope 0 at $DIR/address-of.rs:28:5: 28:16
|
||||
let mut _36: *mut [i32; 10]; // in scope 0 at $DIR/address-of.rs:28:5: 28:16
|
||||
let _37: *mut [i32; 10]; // in scope 0 at $DIR/address-of.rs:29:5: 29:24
|
||||
let _38: *mut dyn std::marker::Send; // in scope 0 at $DIR/address-of.rs:30:5: 30:23
|
||||
let mut _39: *mut dyn std::marker::Send; // in scope 0 at $DIR/address-of.rs:30:5: 30:23
|
||||
let mut _40: *mut [i32; 10]; // in scope 0 at $DIR/address-of.rs:30:5: 30:6
|
||||
let _41: *mut [i32]; // in scope 0 at $DIR/address-of.rs:31:5: 31:20
|
||||
let mut _42: *mut [i32; 10]; // in scope 0 at $DIR/address-of.rs:31:5: 31:6
|
||||
let mut _46: *mut [i32; 10]; // in scope 0 at $DIR/address-of.rs:35:28: 35:29
|
||||
let mut _48: *mut [i32; 10]; // in scope 0 at $DIR/address-of.rs:36:25: 36:26
|
||||
scope 1 {
|
||||
debug y => _1; // in scope 1 at $DIR/address-of.rs:4:9: 4:10
|
||||
let mut _3: &mut [i32; 10]; // in scope 1 at $DIR/address-of.rs:5:9: 5:14
|
||||
scope 2 {
|
||||
debug z => _3; // in scope 2 at $DIR/address-of.rs:5:9: 5:14
|
||||
let _15: *const [i32; 10] as UserTypeProjection { base: UserType(2), projs: [] }; // in scope 2 at $DIR/address-of.rs:13:9: 13:10
|
||||
scope 3 {
|
||||
debug p => _15; // in scope 3 at $DIR/address-of.rs:13:9: 13:10
|
||||
let _16: *const [i32; 10] as UserTypeProjection { base: UserType(4), projs: [] }; // in scope 3 at $DIR/address-of.rs:14:9: 14:10
|
||||
scope 4 {
|
||||
debug p => _16; // in scope 4 at $DIR/address-of.rs:14:9: 14:10
|
||||
let _17: *const dyn std::marker::Send as UserTypeProjection { base: UserType(6), projs: [] }; // in scope 4 at $DIR/address-of.rs:15:9: 15:10
|
||||
scope 5 {
|
||||
debug p => _17; // in scope 5 at $DIR/address-of.rs:15:9: 15:10
|
||||
let _19: *const [i32] as UserTypeProjection { base: UserType(8), projs: [] }; // in scope 5 at $DIR/address-of.rs:16:9: 16:10
|
||||
scope 6 {
|
||||
debug p => _19; // in scope 6 at $DIR/address-of.rs:16:9: 16:10
|
||||
let _29: *const [i32; 10] as UserTypeProjection { base: UserType(12), projs: [] }; // in scope 6 at $DIR/address-of.rs:23:9: 23:10
|
||||
scope 7 {
|
||||
debug p => _29; // in scope 7 at $DIR/address-of.rs:23:9: 23:10
|
||||
let _30: *const [i32; 10] as UserTypeProjection { base: UserType(14), projs: [] }; // in scope 7 at $DIR/address-of.rs:24:9: 24:10
|
||||
scope 8 {
|
||||
debug p => _30; // in scope 8 at $DIR/address-of.rs:24:9: 24:10
|
||||
let _31: *const dyn std::marker::Send as UserTypeProjection { base: UserType(16), projs: [] }; // in scope 8 at $DIR/address-of.rs:25:9: 25:10
|
||||
scope 9 {
|
||||
debug p => _31; // in scope 9 at $DIR/address-of.rs:25:9: 25:10
|
||||
let _33: *const [i32] as UserTypeProjection { base: UserType(18), projs: [] }; // in scope 9 at $DIR/address-of.rs:26:9: 26:10
|
||||
scope 10 {
|
||||
debug p => _33; // in scope 10 at $DIR/address-of.rs:26:9: 26:10
|
||||
let _43: *mut [i32; 10] as UserTypeProjection { base: UserType(22), projs: [] }; // in scope 10 at $DIR/address-of.rs:33:9: 33:10
|
||||
scope 11 {
|
||||
debug p => _43; // in scope 11 at $DIR/address-of.rs:33:9: 33:10
|
||||
let _44: *mut [i32; 10] as UserTypeProjection { base: UserType(24), projs: [] }; // in scope 11 at $DIR/address-of.rs:34:9: 34:10
|
||||
scope 12 {
|
||||
debug p => _44; // in scope 12 at $DIR/address-of.rs:34:9: 34:10
|
||||
let _45: *mut dyn std::marker::Send as UserTypeProjection { base: UserType(26), projs: [] }; // in scope 12 at $DIR/address-of.rs:35:9: 35:10
|
||||
scope 13 {
|
||||
debug p => _45; // in scope 13 at $DIR/address-of.rs:35:9: 35:10
|
||||
let _47: *mut [i32] as UserTypeProjection { base: UserType(28), projs: [] }; // in scope 13 at $DIR/address-of.rs:36:9: 36:10
|
||||
scope 14 {
|
||||
debug p => _47; // in scope 14 at $DIR/address-of.rs:36:9: 36:10
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/address-of.rs:4:9: 4:10
|
||||
StorageLive(_2); // bb0[1]: scope 0 at $DIR/address-of.rs:4:14: 4:21
|
||||
_2 = [const 0i32; 10]; // bb0[2]: scope 0 at $DIR/address-of.rs:4:14: 4:21
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000000))
|
||||
// mir::Constant
|
||||
// + span: $DIR/address-of.rs:4:15: 4:16
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000000)) }
|
||||
_1 = &_2; // bb0[3]: scope 0 at $DIR/address-of.rs:4:13: 4:21
|
||||
FakeRead(ForLet, _1); // bb0[4]: scope 0 at $DIR/address-of.rs:4:9: 4:10
|
||||
StorageLive(_3); // bb0[5]: scope 1 at $DIR/address-of.rs:5:9: 5:14
|
||||
StorageLive(_4); // bb0[6]: scope 1 at $DIR/address-of.rs:5:22: 5:29
|
||||
_4 = [const 0i32; 10]; // bb0[7]: scope 1 at $DIR/address-of.rs:5:22: 5:29
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000000))
|
||||
// mir::Constant
|
||||
// + span: $DIR/address-of.rs:5:23: 5:24
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000000)) }
|
||||
_3 = &mut _4; // bb0[8]: scope 1 at $DIR/address-of.rs:5:17: 5:29
|
||||
FakeRead(ForLet, _3); // bb0[9]: scope 1 at $DIR/address-of.rs:5:9: 5:14
|
||||
StorageLive(_5); // bb0[10]: scope 2 at $DIR/address-of.rs:7:5: 7:18
|
||||
StorageLive(_6); // bb0[11]: scope 2 at $DIR/address-of.rs:7:5: 7:18
|
||||
_6 = &raw const (*_1); // bb0[12]: scope 2 at $DIR/address-of.rs:7:5: 7:6
|
||||
AscribeUserType(_6, o, UserTypeProjection { base: UserType(0), projs: [] }); // bb0[13]: scope 2 at $DIR/address-of.rs:7:5: 7:18
|
||||
_5 = _6; // bb0[14]: scope 2 at $DIR/address-of.rs:7:5: 7:18
|
||||
StorageDead(_6); // bb0[15]: scope 2 at $DIR/address-of.rs:7:18: 7:19
|
||||
StorageDead(_5); // bb0[16]: scope 2 at $DIR/address-of.rs:7:18: 7:19
|
||||
StorageLive(_7); // bb0[17]: scope 2 at $DIR/address-of.rs:8:5: 8:26
|
||||
_7 = &raw const (*_1); // bb0[18]: scope 2 at $DIR/address-of.rs:8:5: 8:6
|
||||
StorageDead(_7); // bb0[19]: scope 2 at $DIR/address-of.rs:8:26: 8:27
|
||||
StorageLive(_8); // bb0[20]: scope 2 at $DIR/address-of.rs:9:5: 9:25
|
||||
StorageLive(_9); // bb0[21]: scope 2 at $DIR/address-of.rs:9:5: 9:25
|
||||
StorageLive(_10); // bb0[22]: scope 2 at $DIR/address-of.rs:9:5: 9:6
|
||||
_10 = &raw const (*_1); // bb0[23]: scope 2 at $DIR/address-of.rs:9:5: 9:6
|
||||
_9 = move _10 as *const dyn std::marker::Send (Pointer(Unsize)); // bb0[24]: scope 2 at $DIR/address-of.rs:9:5: 9:6
|
||||
StorageDead(_10); // bb0[25]: scope 2 at $DIR/address-of.rs:9:5: 9:6
|
||||
AscribeUserType(_9, o, UserTypeProjection { base: UserType(1), projs: [] }); // bb0[26]: scope 2 at $DIR/address-of.rs:9:5: 9:25
|
||||
_8 = _9; // bb0[27]: scope 2 at $DIR/address-of.rs:9:5: 9:25
|
||||
StorageDead(_9); // bb0[28]: scope 2 at $DIR/address-of.rs:9:25: 9:26
|
||||
StorageDead(_8); // bb0[29]: scope 2 at $DIR/address-of.rs:9:25: 9:26
|
||||
StorageLive(_11); // bb0[30]: scope 2 at $DIR/address-of.rs:10:5: 10:22
|
||||
StorageLive(_12); // bb0[31]: scope 2 at $DIR/address-of.rs:10:5: 10:6
|
||||
_12 = &raw const (*_1); // bb0[32]: scope 2 at $DIR/address-of.rs:10:5: 10:6
|
||||
_11 = move _12 as *const [i32] (Pointer(Unsize)); // bb0[33]: scope 2 at $DIR/address-of.rs:10:5: 10:6
|
||||
StorageDead(_12); // bb0[34]: scope 2 at $DIR/address-of.rs:10:5: 10:6
|
||||
StorageDead(_11); // bb0[35]: scope 2 at $DIR/address-of.rs:10:22: 10:23
|
||||
StorageLive(_13); // bb0[36]: scope 2 at $DIR/address-of.rs:11:5: 11:20
|
||||
StorageLive(_14); // bb0[37]: scope 2 at $DIR/address-of.rs:11:5: 11:6
|
||||
_14 = &raw const (*_1); // bb0[38]: scope 2 at $DIR/address-of.rs:11:5: 11:6
|
||||
_13 = move _14 as *const i32 (Pointer(ArrayToPointer)); // bb0[39]: scope 2 at $DIR/address-of.rs:11:5: 11:20
|
||||
StorageDead(_14); // bb0[40]: scope 2 at $DIR/address-of.rs:11:19: 11:20
|
||||
StorageDead(_13); // bb0[41]: scope 2 at $DIR/address-of.rs:11:20: 11:21
|
||||
StorageLive(_15); // bb0[42]: scope 2 at $DIR/address-of.rs:13:9: 13:10
|
||||
_15 = &raw const (*_1); // bb0[43]: scope 2 at $DIR/address-of.rs:13:23: 13:24
|
||||
FakeRead(ForLet, _15); // bb0[44]: scope 2 at $DIR/address-of.rs:13:9: 13:10
|
||||
AscribeUserType(_15, o, UserTypeProjection { base: UserType(3), projs: [] }); // bb0[45]: scope 2 at $DIR/address-of.rs:13:12: 13:20
|
||||
StorageLive(_16); // bb0[46]: scope 3 at $DIR/address-of.rs:14:9: 14:10
|
||||
_16 = &raw const (*_1); // bb0[47]: scope 3 at $DIR/address-of.rs:14:31: 14:32
|
||||
FakeRead(ForLet, _16); // bb0[48]: scope 3 at $DIR/address-of.rs:14:9: 14:10
|
||||
AscribeUserType(_16, o, UserTypeProjection { base: UserType(5), projs: [] }); // bb0[49]: scope 3 at $DIR/address-of.rs:14:12: 14:28
|
||||
StorageLive(_17); // bb0[50]: scope 4 at $DIR/address-of.rs:15:9: 15:10
|
||||
StorageLive(_18); // bb0[51]: scope 4 at $DIR/address-of.rs:15:30: 15:31
|
||||
_18 = &raw const (*_1); // bb0[52]: scope 4 at $DIR/address-of.rs:15:30: 15:31
|
||||
_17 = move _18 as *const dyn std::marker::Send (Pointer(Unsize)); // bb0[53]: scope 4 at $DIR/address-of.rs:15:30: 15:31
|
||||
StorageDead(_18); // bb0[54]: scope 4 at $DIR/address-of.rs:15:30: 15:31
|
||||
FakeRead(ForLet, _17); // bb0[55]: scope 4 at $DIR/address-of.rs:15:9: 15:10
|
||||
AscribeUserType(_17, o, UserTypeProjection { base: UserType(7), projs: [] }); // bb0[56]: scope 4 at $DIR/address-of.rs:15:12: 15:27
|
||||
StorageLive(_19); // bb0[57]: scope 5 at $DIR/address-of.rs:16:9: 16:10
|
||||
StorageLive(_20); // bb0[58]: scope 5 at $DIR/address-of.rs:16:27: 16:28
|
||||
_20 = &raw const (*_1); // bb0[59]: scope 5 at $DIR/address-of.rs:16:27: 16:28
|
||||
_19 = move _20 as *const [i32] (Pointer(Unsize)); // bb0[60]: scope 5 at $DIR/address-of.rs:16:27: 16:28
|
||||
StorageDead(_20); // bb0[61]: scope 5 at $DIR/address-of.rs:16:27: 16:28
|
||||
FakeRead(ForLet, _19); // bb0[62]: scope 5 at $DIR/address-of.rs:16:9: 16:10
|
||||
AscribeUserType(_19, o, UserTypeProjection { base: UserType(9), projs: [] }); // bb0[63]: scope 5 at $DIR/address-of.rs:16:12: 16:24
|
||||
StorageLive(_21); // bb0[64]: scope 6 at $DIR/address-of.rs:18:5: 18:18
|
||||
StorageLive(_22); // bb0[65]: scope 6 at $DIR/address-of.rs:18:5: 18:18
|
||||
_22 = &raw const (*_3); // bb0[66]: scope 6 at $DIR/address-of.rs:18:5: 18:6
|
||||
AscribeUserType(_22, o, UserTypeProjection { base: UserType(10), projs: [] }); // bb0[67]: scope 6 at $DIR/address-of.rs:18:5: 18:18
|
||||
_21 = _22; // bb0[68]: scope 6 at $DIR/address-of.rs:18:5: 18:18
|
||||
StorageDead(_22); // bb0[69]: scope 6 at $DIR/address-of.rs:18:18: 18:19
|
||||
StorageDead(_21); // bb0[70]: scope 6 at $DIR/address-of.rs:18:18: 18:19
|
||||
StorageLive(_23); // bb0[71]: scope 6 at $DIR/address-of.rs:19:5: 19:26
|
||||
_23 = &raw const (*_3); // bb0[72]: scope 6 at $DIR/address-of.rs:19:5: 19:6
|
||||
StorageDead(_23); // bb0[73]: scope 6 at $DIR/address-of.rs:19:26: 19:27
|
||||
StorageLive(_24); // bb0[74]: scope 6 at $DIR/address-of.rs:20:5: 20:25
|
||||
StorageLive(_25); // bb0[75]: scope 6 at $DIR/address-of.rs:20:5: 20:25
|
||||
StorageLive(_26); // bb0[76]: scope 6 at $DIR/address-of.rs:20:5: 20:6
|
||||
_26 = &raw const (*_3); // bb0[77]: scope 6 at $DIR/address-of.rs:20:5: 20:6
|
||||
_25 = move _26 as *const dyn std::marker::Send (Pointer(Unsize)); // bb0[78]: scope 6 at $DIR/address-of.rs:20:5: 20:6
|
||||
StorageDead(_26); // bb0[79]: scope 6 at $DIR/address-of.rs:20:5: 20:6
|
||||
AscribeUserType(_25, o, UserTypeProjection { base: UserType(11), projs: [] }); // bb0[80]: scope 6 at $DIR/address-of.rs:20:5: 20:25
|
||||
_24 = _25; // bb0[81]: scope 6 at $DIR/address-of.rs:20:5: 20:25
|
||||
StorageDead(_25); // bb0[82]: scope 6 at $DIR/address-of.rs:20:25: 20:26
|
||||
StorageDead(_24); // bb0[83]: scope 6 at $DIR/address-of.rs:20:25: 20:26
|
||||
StorageLive(_27); // bb0[84]: scope 6 at $DIR/address-of.rs:21:5: 21:22
|
||||
StorageLive(_28); // bb0[85]: scope 6 at $DIR/address-of.rs:21:5: 21:6
|
||||
_28 = &raw const (*_3); // bb0[86]: scope 6 at $DIR/address-of.rs:21:5: 21:6
|
||||
_27 = move _28 as *const [i32] (Pointer(Unsize)); // bb0[87]: scope 6 at $DIR/address-of.rs:21:5: 21:6
|
||||
StorageDead(_28); // bb0[88]: scope 6 at $DIR/address-of.rs:21:5: 21:6
|
||||
StorageDead(_27); // bb0[89]: scope 6 at $DIR/address-of.rs:21:22: 21:23
|
||||
StorageLive(_29); // bb0[90]: scope 6 at $DIR/address-of.rs:23:9: 23:10
|
||||
_29 = &raw const (*_3); // bb0[91]: scope 6 at $DIR/address-of.rs:23:23: 23:24
|
||||
FakeRead(ForLet, _29); // bb0[92]: scope 6 at $DIR/address-of.rs:23:9: 23:10
|
||||
AscribeUserType(_29, o, UserTypeProjection { base: UserType(13), projs: [] }); // bb0[93]: scope 6 at $DIR/address-of.rs:23:12: 23:20
|
||||
StorageLive(_30); // bb0[94]: scope 7 at $DIR/address-of.rs:24:9: 24:10
|
||||
_30 = &raw const (*_3); // bb0[95]: scope 7 at $DIR/address-of.rs:24:31: 24:32
|
||||
FakeRead(ForLet, _30); // bb0[96]: scope 7 at $DIR/address-of.rs:24:9: 24:10
|
||||
AscribeUserType(_30, o, UserTypeProjection { base: UserType(15), projs: [] }); // bb0[97]: scope 7 at $DIR/address-of.rs:24:12: 24:28
|
||||
StorageLive(_31); // bb0[98]: scope 8 at $DIR/address-of.rs:25:9: 25:10
|
||||
StorageLive(_32); // bb0[99]: scope 8 at $DIR/address-of.rs:25:30: 25:31
|
||||
_32 = &raw const (*_3); // bb0[100]: scope 8 at $DIR/address-of.rs:25:30: 25:31
|
||||
_31 = move _32 as *const dyn std::marker::Send (Pointer(Unsize)); // bb0[101]: scope 8 at $DIR/address-of.rs:25:30: 25:31
|
||||
StorageDead(_32); // bb0[102]: scope 8 at $DIR/address-of.rs:25:30: 25:31
|
||||
FakeRead(ForLet, _31); // bb0[103]: scope 8 at $DIR/address-of.rs:25:9: 25:10
|
||||
AscribeUserType(_31, o, UserTypeProjection { base: UserType(17), projs: [] }); // bb0[104]: scope 8 at $DIR/address-of.rs:25:12: 25:27
|
||||
StorageLive(_33); // bb0[105]: scope 9 at $DIR/address-of.rs:26:9: 26:10
|
||||
StorageLive(_34); // bb0[106]: scope 9 at $DIR/address-of.rs:26:27: 26:28
|
||||
_34 = &raw const (*_3); // bb0[107]: scope 9 at $DIR/address-of.rs:26:27: 26:28
|
||||
_33 = move _34 as *const [i32] (Pointer(Unsize)); // bb0[108]: scope 9 at $DIR/address-of.rs:26:27: 26:28
|
||||
StorageDead(_34); // bb0[109]: scope 9 at $DIR/address-of.rs:26:27: 26:28
|
||||
FakeRead(ForLet, _33); // bb0[110]: scope 9 at $DIR/address-of.rs:26:9: 26:10
|
||||
AscribeUserType(_33, o, UserTypeProjection { base: UserType(19), projs: [] }); // bb0[111]: scope 9 at $DIR/address-of.rs:26:12: 26:24
|
||||
StorageLive(_35); // bb0[112]: scope 10 at $DIR/address-of.rs:28:5: 28:16
|
||||
StorageLive(_36); // bb0[113]: scope 10 at $DIR/address-of.rs:28:5: 28:16
|
||||
_36 = &raw mut (*_3); // bb0[114]: scope 10 at $DIR/address-of.rs:28:5: 28:6
|
||||
AscribeUserType(_36, o, UserTypeProjection { base: UserType(20), projs: [] }); // bb0[115]: scope 10 at $DIR/address-of.rs:28:5: 28:16
|
||||
_35 = _36; // bb0[116]: scope 10 at $DIR/address-of.rs:28:5: 28:16
|
||||
StorageDead(_36); // bb0[117]: scope 10 at $DIR/address-of.rs:28:16: 28:17
|
||||
StorageDead(_35); // bb0[118]: scope 10 at $DIR/address-of.rs:28:16: 28:17
|
||||
StorageLive(_37); // bb0[119]: scope 10 at $DIR/address-of.rs:29:5: 29:24
|
||||
_37 = &raw mut (*_3); // bb0[120]: scope 10 at $DIR/address-of.rs:29:5: 29:6
|
||||
StorageDead(_37); // bb0[121]: scope 10 at $DIR/address-of.rs:29:24: 29:25
|
||||
StorageLive(_38); // bb0[122]: scope 10 at $DIR/address-of.rs:30:5: 30:23
|
||||
StorageLive(_39); // bb0[123]: scope 10 at $DIR/address-of.rs:30:5: 30:23
|
||||
StorageLive(_40); // bb0[124]: scope 10 at $DIR/address-of.rs:30:5: 30:6
|
||||
_40 = &raw mut (*_3); // bb0[125]: scope 10 at $DIR/address-of.rs:30:5: 30:6
|
||||
_39 = move _40 as *mut dyn std::marker::Send (Pointer(Unsize)); // bb0[126]: scope 10 at $DIR/address-of.rs:30:5: 30:6
|
||||
StorageDead(_40); // bb0[127]: scope 10 at $DIR/address-of.rs:30:5: 30:6
|
||||
AscribeUserType(_39, o, UserTypeProjection { base: UserType(21), projs: [] }); // bb0[128]: scope 10 at $DIR/address-of.rs:30:5: 30:23
|
||||
_38 = _39; // bb0[129]: scope 10 at $DIR/address-of.rs:30:5: 30:23
|
||||
StorageDead(_39); // bb0[130]: scope 10 at $DIR/address-of.rs:30:23: 30:24
|
||||
StorageDead(_38); // bb0[131]: scope 10 at $DIR/address-of.rs:30:23: 30:24
|
||||
StorageLive(_41); // bb0[132]: scope 10 at $DIR/address-of.rs:31:5: 31:20
|
||||
StorageLive(_42); // bb0[133]: scope 10 at $DIR/address-of.rs:31:5: 31:6
|
||||
_42 = &raw mut (*_3); // bb0[134]: scope 10 at $DIR/address-of.rs:31:5: 31:6
|
||||
_41 = move _42 as *mut [i32] (Pointer(Unsize)); // bb0[135]: scope 10 at $DIR/address-of.rs:31:5: 31:6
|
||||
StorageDead(_42); // bb0[136]: scope 10 at $DIR/address-of.rs:31:5: 31:6
|
||||
StorageDead(_41); // bb0[137]: scope 10 at $DIR/address-of.rs:31:20: 31:21
|
||||
StorageLive(_43); // bb0[138]: scope 10 at $DIR/address-of.rs:33:9: 33:10
|
||||
_43 = &raw mut (*_3); // bb0[139]: scope 10 at $DIR/address-of.rs:33:21: 33:22
|
||||
FakeRead(ForLet, _43); // bb0[140]: scope 10 at $DIR/address-of.rs:33:9: 33:10
|
||||
AscribeUserType(_43, o, UserTypeProjection { base: UserType(23), projs: [] }); // bb0[141]: scope 10 at $DIR/address-of.rs:33:12: 33:18
|
||||
StorageLive(_44); // bb0[142]: scope 11 at $DIR/address-of.rs:34:9: 34:10
|
||||
_44 = &raw mut (*_3); // bb0[143]: scope 11 at $DIR/address-of.rs:34:29: 34:30
|
||||
FakeRead(ForLet, _44); // bb0[144]: scope 11 at $DIR/address-of.rs:34:9: 34:10
|
||||
AscribeUserType(_44, o, UserTypeProjection { base: UserType(25), projs: [] }); // bb0[145]: scope 11 at $DIR/address-of.rs:34:12: 34:26
|
||||
StorageLive(_45); // bb0[146]: scope 12 at $DIR/address-of.rs:35:9: 35:10
|
||||
StorageLive(_46); // bb0[147]: scope 12 at $DIR/address-of.rs:35:28: 35:29
|
||||
_46 = &raw mut (*_3); // bb0[148]: scope 12 at $DIR/address-of.rs:35:28: 35:29
|
||||
_45 = move _46 as *mut dyn std::marker::Send (Pointer(Unsize)); // bb0[149]: scope 12 at $DIR/address-of.rs:35:28: 35:29
|
||||
StorageDead(_46); // bb0[150]: scope 12 at $DIR/address-of.rs:35:28: 35:29
|
||||
FakeRead(ForLet, _45); // bb0[151]: scope 12 at $DIR/address-of.rs:35:9: 35:10
|
||||
AscribeUserType(_45, o, UserTypeProjection { base: UserType(27), projs: [] }); // bb0[152]: scope 12 at $DIR/address-of.rs:35:12: 35:25
|
||||
StorageLive(_47); // bb0[153]: scope 13 at $DIR/address-of.rs:36:9: 36:10
|
||||
StorageLive(_48); // bb0[154]: scope 13 at $DIR/address-of.rs:36:25: 36:26
|
||||
_48 = &raw mut (*_3); // bb0[155]: scope 13 at $DIR/address-of.rs:36:25: 36:26
|
||||
_47 = move _48 as *mut [i32] (Pointer(Unsize)); // bb0[156]: scope 13 at $DIR/address-of.rs:36:25: 36:26
|
||||
StorageDead(_48); // bb0[157]: scope 13 at $DIR/address-of.rs:36:25: 36:26
|
||||
FakeRead(ForLet, _47); // bb0[158]: scope 13 at $DIR/address-of.rs:36:9: 36:10
|
||||
AscribeUserType(_47, o, UserTypeProjection { base: UserType(29), projs: [] }); // bb0[159]: scope 13 at $DIR/address-of.rs:36:12: 36:22
|
||||
_0 = (); // bb0[160]: scope 0 at $DIR/address-of.rs:3:26: 37:2
|
||||
StorageDead(_47); // bb0[161]: scope 13 at $DIR/address-of.rs:37:1: 37:2
|
||||
StorageDead(_45); // bb0[162]: scope 12 at $DIR/address-of.rs:37:1: 37:2
|
||||
StorageDead(_44); // bb0[163]: scope 11 at $DIR/address-of.rs:37:1: 37:2
|
||||
StorageDead(_43); // bb0[164]: scope 10 at $DIR/address-of.rs:37:1: 37:2
|
||||
StorageDead(_33); // bb0[165]: scope 9 at $DIR/address-of.rs:37:1: 37:2
|
||||
StorageDead(_31); // bb0[166]: scope 8 at $DIR/address-of.rs:37:1: 37:2
|
||||
StorageDead(_30); // bb0[167]: scope 7 at $DIR/address-of.rs:37:1: 37:2
|
||||
StorageDead(_29); // bb0[168]: scope 6 at $DIR/address-of.rs:37:1: 37:2
|
||||
StorageDead(_19); // bb0[169]: scope 5 at $DIR/address-of.rs:37:1: 37:2
|
||||
StorageDead(_17); // bb0[170]: scope 4 at $DIR/address-of.rs:37:1: 37:2
|
||||
StorageDead(_16); // bb0[171]: scope 3 at $DIR/address-of.rs:37:1: 37:2
|
||||
StorageDead(_15); // bb0[172]: scope 2 at $DIR/address-of.rs:37:1: 37:2
|
||||
StorageDead(_4); // bb0[173]: scope 1 at $DIR/address-of.rs:37:1: 37:2
|
||||
StorageDead(_3); // bb0[174]: scope 1 at $DIR/address-of.rs:37:1: 37:2
|
||||
StorageDead(_2); // bb0[175]: scope 0 at $DIR/address-of.rs:37:1: 37:2
|
||||
StorageDead(_1); // bb0[176]: scope 0 at $DIR/address-of.rs:37:1: 37:2
|
||||
return; // bb0[177]: scope 0 at $DIR/address-of.rs:37:2: 37:2
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
// MIR for `borrow_and_cast` after SimplifyCfg-initial
|
||||
|
||||
fn borrow_and_cast(_1: i32) -> () {
|
||||
debug x => _1; // in scope 0 at $DIR/address-of.rs:41:20: 41:25
|
||||
let mut _0: (); // return place in scope 0 at $DIR/address-of.rs:41:32: 41:32
|
||||
let _2: *const i32; // in scope 0 at $DIR/address-of.rs:42:9: 42:10
|
||||
let _3: &i32; // in scope 0 at $DIR/address-of.rs:42:13: 42:15
|
||||
let _5: &mut i32; // in scope 0 at $DIR/address-of.rs:43:13: 43:19
|
||||
let mut _7: &mut i32; // in scope 0 at $DIR/address-of.rs:44:13: 44:19
|
||||
scope 1 {
|
||||
debug p => _2; // in scope 1 at $DIR/address-of.rs:42:9: 42:10
|
||||
let _4: *const i32; // in scope 1 at $DIR/address-of.rs:43:9: 43:10
|
||||
scope 2 {
|
||||
debug q => _4; // in scope 2 at $DIR/address-of.rs:43:9: 43:10
|
||||
let _6: *mut i32; // in scope 2 at $DIR/address-of.rs:44:9: 44:10
|
||||
scope 3 {
|
||||
debug r => _6; // in scope 3 at $DIR/address-of.rs:44:9: 44:10
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_2); // bb0[0]: scope 0 at $DIR/address-of.rs:42:9: 42:10
|
||||
StorageLive(_3); // bb0[1]: scope 0 at $DIR/address-of.rs:42:13: 42:15
|
||||
_3 = &_1; // bb0[2]: scope 0 at $DIR/address-of.rs:42:13: 42:15
|
||||
_2 = &raw const (*_3); // bb0[3]: scope 0 at $DIR/address-of.rs:42:13: 42:15
|
||||
FakeRead(ForLet, _2); // bb0[4]: scope 0 at $DIR/address-of.rs:42:9: 42:10
|
||||
StorageDead(_3); // bb0[5]: scope 0 at $DIR/address-of.rs:42:29: 42:30
|
||||
StorageLive(_4); // bb0[6]: scope 1 at $DIR/address-of.rs:43:9: 43:10
|
||||
StorageLive(_5); // bb0[7]: scope 1 at $DIR/address-of.rs:43:13: 43:19
|
||||
_5 = &mut _1; // bb0[8]: scope 1 at $DIR/address-of.rs:43:13: 43:19
|
||||
_4 = &raw const (*_5); // bb0[9]: scope 1 at $DIR/address-of.rs:43:13: 43:19
|
||||
FakeRead(ForLet, _4); // bb0[10]: scope 1 at $DIR/address-of.rs:43:9: 43:10
|
||||
StorageDead(_5); // bb0[11]: scope 1 at $DIR/address-of.rs:43:33: 43:34
|
||||
StorageLive(_6); // bb0[12]: scope 2 at $DIR/address-of.rs:44:9: 44:10
|
||||
StorageLive(_7); // bb0[13]: scope 2 at $DIR/address-of.rs:44:13: 44:19
|
||||
_7 = &mut _1; // bb0[14]: scope 2 at $DIR/address-of.rs:44:13: 44:19
|
||||
_6 = &raw mut (*_7); // bb0[15]: scope 2 at $DIR/address-of.rs:44:13: 44:19
|
||||
FakeRead(ForLet, _6); // bb0[16]: scope 2 at $DIR/address-of.rs:44:9: 44:10
|
||||
StorageDead(_7); // bb0[17]: scope 2 at $DIR/address-of.rs:44:31: 44:32
|
||||
_0 = (); // bb0[18]: scope 0 at $DIR/address-of.rs:41:32: 45:2
|
||||
StorageDead(_6); // bb0[19]: scope 2 at $DIR/address-of.rs:45:1: 45:2
|
||||
StorageDead(_4); // bb0[20]: scope 1 at $DIR/address-of.rs:45:1: 45:2
|
||||
StorageDead(_2); // bb0[21]: scope 0 at $DIR/address-of.rs:45:1: 45:2
|
||||
return; // bb0[22]: scope 0 at $DIR/address-of.rs:45:2: 45:2
|
||||
}
|
||||
}
|
|
@ -7,35 +7,11 @@ unsafe fn foo(z: *mut usize) -> u32 {
|
|||
99
|
||||
}
|
||||
|
||||
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
||||
// EMIT_MIR rustc.main.SimplifyCfg-elaborate-drops.after.mir
|
||||
fn main() {
|
||||
let mut x = [42, 43, 44];
|
||||
let mut y = 1;
|
||||
let z: *mut usize = &mut y;
|
||||
x[y] = unsafe { foo(z) };
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
// START rustc.main.SimplifyCfg-elaborate-drops.after.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _4 = &mut _2;
|
||||
// _3 = &raw mut (*_4);
|
||||
// ...
|
||||
// _6 = _3;
|
||||
// _5 = const foo(move _6) -> bb1;
|
||||
// }
|
||||
//
|
||||
// bb1: {
|
||||
// ...
|
||||
// _7 = _2;
|
||||
// _8 = Len(_1);
|
||||
// _9 = Lt(_7, _8);
|
||||
// assert(move _9, "index out of bounds: the len is move _8 but the index is _7") -> bb2;
|
||||
// }
|
||||
//
|
||||
// bb2: {
|
||||
// _1[_7] = move _5;
|
||||
// ...
|
||||
// return;
|
||||
// }
|
||||
// END rustc.main.SimplifyCfg-elaborate-drops.after.mir
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
// MIR for `main` after SimplifyCfg-elaborate-drops
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/array-index-is-temporary.rs:12:11: 12:11
|
||||
let mut _1: [u32; 3]; // in scope 0 at $DIR/array-index-is-temporary.rs:13:9: 13:14
|
||||
let mut _4: &mut usize; // in scope 0 at $DIR/array-index-is-temporary.rs:15:25: 15:31
|
||||
let mut _5: u32; // in scope 0 at $DIR/array-index-is-temporary.rs:16:12: 16:29
|
||||
let mut _6: *mut usize; // in scope 0 at $DIR/array-index-is-temporary.rs:16:25: 16:26
|
||||
let _7: usize; // in scope 0 at $DIR/array-index-is-temporary.rs:16:7: 16:8
|
||||
let mut _8: usize; // in scope 0 at $DIR/array-index-is-temporary.rs:16:5: 16:9
|
||||
let mut _9: bool; // in scope 0 at $DIR/array-index-is-temporary.rs:16:5: 16:9
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/array-index-is-temporary.rs:13:9: 13:14
|
||||
let mut _2: usize; // in scope 1 at $DIR/array-index-is-temporary.rs:14:9: 14:14
|
||||
scope 2 {
|
||||
debug y => _2; // in scope 2 at $DIR/array-index-is-temporary.rs:14:9: 14:14
|
||||
let _3: *mut usize as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 2 at $DIR/array-index-is-temporary.rs:15:9: 15:10
|
||||
scope 3 {
|
||||
debug z => _3; // in scope 3 at $DIR/array-index-is-temporary.rs:15:9: 15:10
|
||||
scope 4 {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/array-index-is-temporary.rs:13:9: 13:14
|
||||
_1 = [const 42u32, const 43u32, const 44u32]; // bb0[1]: scope 0 at $DIR/array-index-is-temporary.rs:13:17: 13:29
|
||||
// ty::Const
|
||||
// + ty: u32
|
||||
// + val: Value(Scalar(0x0000002a))
|
||||
// mir::Constant
|
||||
// + span: $DIR/array-index-is-temporary.rs:13:18: 13:20
|
||||
// + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) }
|
||||
// ty::Const
|
||||
// + ty: u32
|
||||
// + val: Value(Scalar(0x0000002b))
|
||||
// mir::Constant
|
||||
// + span: $DIR/array-index-is-temporary.rs:13:22: 13:24
|
||||
// + literal: Const { ty: u32, val: Value(Scalar(0x0000002b)) }
|
||||
// ty::Const
|
||||
// + ty: u32
|
||||
// + val: Value(Scalar(0x0000002c))
|
||||
// mir::Constant
|
||||
// + span: $DIR/array-index-is-temporary.rs:13:26: 13:28
|
||||
// + literal: Const { ty: u32, val: Value(Scalar(0x0000002c)) }
|
||||
StorageLive(_2); // bb0[2]: scope 1 at $DIR/array-index-is-temporary.rs:14:9: 14:14
|
||||
_2 = const 1usize; // bb0[3]: scope 1 at $DIR/array-index-is-temporary.rs:14:17: 14:18
|
||||
// ty::Const
|
||||
// + ty: usize
|
||||
// + val: Value(Scalar(0x00000001))
|
||||
// mir::Constant
|
||||
// + span: $DIR/array-index-is-temporary.rs:14:17: 14:18
|
||||
// + literal: Const { ty: usize, val: Value(Scalar(0x00000001)) }
|
||||
StorageLive(_3); // bb0[4]: scope 2 at $DIR/array-index-is-temporary.rs:15:9: 15:10
|
||||
StorageLive(_4); // bb0[5]: scope 2 at $DIR/array-index-is-temporary.rs:15:25: 15:31
|
||||
_4 = &mut _2; // bb0[6]: scope 2 at $DIR/array-index-is-temporary.rs:15:25: 15:31
|
||||
_3 = &raw mut (*_4); // bb0[7]: scope 2 at $DIR/array-index-is-temporary.rs:15:25: 15:31
|
||||
StorageDead(_4); // bb0[8]: scope 2 at $DIR/array-index-is-temporary.rs:15:31: 15:32
|
||||
StorageLive(_5); // bb0[9]: scope 3 at $DIR/array-index-is-temporary.rs:16:12: 16:29
|
||||
StorageLive(_6); // bb0[10]: scope 4 at $DIR/array-index-is-temporary.rs:16:25: 16:26
|
||||
_6 = _3; // bb0[11]: scope 4 at $DIR/array-index-is-temporary.rs:16:25: 16:26
|
||||
_5 = const foo(move _6) -> bb1; // bb0[12]: scope 4 at $DIR/array-index-is-temporary.rs:16:21: 16:27
|
||||
// ty::Const
|
||||
// + ty: unsafe fn(*mut usize) -> u32 {foo}
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $DIR/array-index-is-temporary.rs:16:21: 16:24
|
||||
// + literal: Const { ty: unsafe fn(*mut usize) -> u32 {foo}, val: Value(Scalar(<ZST>)) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
StorageDead(_6); // bb1[0]: scope 4 at $DIR/array-index-is-temporary.rs:16:26: 16:27
|
||||
StorageLive(_7); // bb1[1]: scope 3 at $DIR/array-index-is-temporary.rs:16:7: 16:8
|
||||
_7 = _2; // bb1[2]: scope 3 at $DIR/array-index-is-temporary.rs:16:7: 16:8
|
||||
_8 = Len(_1); // bb1[3]: scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:9
|
||||
_9 = Lt(_7, _8); // bb1[4]: scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:9
|
||||
assert(move _9, "index out of bounds: the len is move _8 but the index is _7") -> bb2; // bb1[5]: scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:9
|
||||
}
|
||||
|
||||
bb2: {
|
||||
_1[_7] = move _5; // bb2[0]: scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:29
|
||||
StorageDead(_5); // bb2[1]: scope 3 at $DIR/array-index-is-temporary.rs:16:28: 16:29
|
||||
StorageDead(_7); // bb2[2]: scope 3 at $DIR/array-index-is-temporary.rs:16:29: 16:30
|
||||
_0 = (); // bb2[3]: scope 0 at $DIR/array-index-is-temporary.rs:12:11: 17:2
|
||||
StorageDead(_3); // bb2[4]: scope 2 at $DIR/array-index-is-temporary.rs:17:1: 17:2
|
||||
StorageDead(_2); // bb2[5]: scope 1 at $DIR/array-index-is-temporary.rs:17:1: 17:2
|
||||
StorageDead(_1); // bb2[6]: scope 0 at $DIR/array-index-is-temporary.rs:17:1: 17:2
|
||||
return; // bb2[7]: scope 0 at $DIR/array-index-is-temporary.rs:17:2: 17:2
|
||||
}
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
// MIR for `main` after SimplifyCfg-elaborate-drops
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/array-index-is-temporary.rs:12:11: 12:11
|
||||
let mut _1: [u32; 3]; // in scope 0 at $DIR/array-index-is-temporary.rs:13:9: 13:14
|
||||
let mut _4: &mut usize; // in scope 0 at $DIR/array-index-is-temporary.rs:15:25: 15:31
|
||||
let mut _5: u32; // in scope 0 at $DIR/array-index-is-temporary.rs:16:12: 16:29
|
||||
let mut _6: *mut usize; // in scope 0 at $DIR/array-index-is-temporary.rs:16:25: 16:26
|
||||
let _7: usize; // in scope 0 at $DIR/array-index-is-temporary.rs:16:7: 16:8
|
||||
let mut _8: usize; // in scope 0 at $DIR/array-index-is-temporary.rs:16:5: 16:9
|
||||
let mut _9: bool; // in scope 0 at $DIR/array-index-is-temporary.rs:16:5: 16:9
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/array-index-is-temporary.rs:13:9: 13:14
|
||||
let mut _2: usize; // in scope 1 at $DIR/array-index-is-temporary.rs:14:9: 14:14
|
||||
scope 2 {
|
||||
debug y => _2; // in scope 2 at $DIR/array-index-is-temporary.rs:14:9: 14:14
|
||||
let _3: *mut usize as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 2 at $DIR/array-index-is-temporary.rs:15:9: 15:10
|
||||
scope 3 {
|
||||
debug z => _3; // in scope 3 at $DIR/array-index-is-temporary.rs:15:9: 15:10
|
||||
scope 4 {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/array-index-is-temporary.rs:13:9: 13:14
|
||||
_1 = [const 42u32, const 43u32, const 44u32]; // bb0[1]: scope 0 at $DIR/array-index-is-temporary.rs:13:17: 13:29
|
||||
// ty::Const
|
||||
// + ty: u32
|
||||
// + val: Value(Scalar(0x0000002a))
|
||||
// mir::Constant
|
||||
// + span: $DIR/array-index-is-temporary.rs:13:18: 13:20
|
||||
// + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) }
|
||||
// ty::Const
|
||||
// + ty: u32
|
||||
// + val: Value(Scalar(0x0000002b))
|
||||
// mir::Constant
|
||||
// + span: $DIR/array-index-is-temporary.rs:13:22: 13:24
|
||||
// + literal: Const { ty: u32, val: Value(Scalar(0x0000002b)) }
|
||||
// ty::Const
|
||||
// + ty: u32
|
||||
// + val: Value(Scalar(0x0000002c))
|
||||
// mir::Constant
|
||||
// + span: $DIR/array-index-is-temporary.rs:13:26: 13:28
|
||||
// + literal: Const { ty: u32, val: Value(Scalar(0x0000002c)) }
|
||||
StorageLive(_2); // bb0[2]: scope 1 at $DIR/array-index-is-temporary.rs:14:9: 14:14
|
||||
_2 = const 1usize; // bb0[3]: scope 1 at $DIR/array-index-is-temporary.rs:14:17: 14:18
|
||||
// ty::Const
|
||||
// + ty: usize
|
||||
// + val: Value(Scalar(0x0000000000000001))
|
||||
// mir::Constant
|
||||
// + span: $DIR/array-index-is-temporary.rs:14:17: 14:18
|
||||
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) }
|
||||
StorageLive(_3); // bb0[4]: scope 2 at $DIR/array-index-is-temporary.rs:15:9: 15:10
|
||||
StorageLive(_4); // bb0[5]: scope 2 at $DIR/array-index-is-temporary.rs:15:25: 15:31
|
||||
_4 = &mut _2; // bb0[6]: scope 2 at $DIR/array-index-is-temporary.rs:15:25: 15:31
|
||||
_3 = &raw mut (*_4); // bb0[7]: scope 2 at $DIR/array-index-is-temporary.rs:15:25: 15:31
|
||||
StorageDead(_4); // bb0[8]: scope 2 at $DIR/array-index-is-temporary.rs:15:31: 15:32
|
||||
StorageLive(_5); // bb0[9]: scope 3 at $DIR/array-index-is-temporary.rs:16:12: 16:29
|
||||
StorageLive(_6); // bb0[10]: scope 4 at $DIR/array-index-is-temporary.rs:16:25: 16:26
|
||||
_6 = _3; // bb0[11]: scope 4 at $DIR/array-index-is-temporary.rs:16:25: 16:26
|
||||
_5 = const foo(move _6) -> bb1; // bb0[12]: scope 4 at $DIR/array-index-is-temporary.rs:16:21: 16:27
|
||||
// ty::Const
|
||||
// + ty: unsafe fn(*mut usize) -> u32 {foo}
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $DIR/array-index-is-temporary.rs:16:21: 16:24
|
||||
// + literal: Const { ty: unsafe fn(*mut usize) -> u32 {foo}, val: Value(Scalar(<ZST>)) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
StorageDead(_6); // bb1[0]: scope 4 at $DIR/array-index-is-temporary.rs:16:26: 16:27
|
||||
StorageLive(_7); // bb1[1]: scope 3 at $DIR/array-index-is-temporary.rs:16:7: 16:8
|
||||
_7 = _2; // bb1[2]: scope 3 at $DIR/array-index-is-temporary.rs:16:7: 16:8
|
||||
_8 = Len(_1); // bb1[3]: scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:9
|
||||
_9 = Lt(_7, _8); // bb1[4]: scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:9
|
||||
assert(move _9, "index out of bounds: the len is move _8 but the index is _7") -> bb2; // bb1[5]: scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:9
|
||||
}
|
||||
|
||||
bb2: {
|
||||
_1[_7] = move _5; // bb2[0]: scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:29
|
||||
StorageDead(_5); // bb2[1]: scope 3 at $DIR/array-index-is-temporary.rs:16:28: 16:29
|
||||
StorageDead(_7); // bb2[2]: scope 3 at $DIR/array-index-is-temporary.rs:16:29: 16:30
|
||||
_0 = (); // bb2[3]: scope 0 at $DIR/array-index-is-temporary.rs:12:11: 17:2
|
||||
StorageDead(_3); // bb2[4]: scope 2 at $DIR/array-index-is-temporary.rs:17:1: 17:2
|
||||
StorageDead(_2); // bb2[5]: scope 1 at $DIR/array-index-is-temporary.rs:17:1: 17:2
|
||||
StorageDead(_1); // bb2[6]: scope 0 at $DIR/array-index-is-temporary.rs:17:1: 17:2
|
||||
return; // bb2[7]: scope 0 at $DIR/array-index-is-temporary.rs:17:2: 17:2
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#![feature(box_syntax)]
|
||||
|
||||
// EMIT_MIR rustc.main.ElaborateDrops.before.mir
|
||||
fn main() {
|
||||
let x = box S::new();
|
||||
drop(x);
|
||||
|
@ -18,60 +19,3 @@ impl Drop for S {
|
|||
println!("splat!");
|
||||
}
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
// START rustc.main.ElaborateDrops.before.mir
|
||||
// let mut _0: ();
|
||||
// let _1: std::boxed::Box<S>;
|
||||
// let mut _2: std::boxed::Box<S>;
|
||||
// let _3: ();
|
||||
// let mut _4: std::boxed::Box<S>;
|
||||
// scope 1 {
|
||||
// debug x => _1;
|
||||
// }
|
||||
// bb0: {
|
||||
// StorageLive(_1);
|
||||
// StorageLive(_2);
|
||||
// _2 = Box(S);
|
||||
// (*_2) = const S::new() -> [return: bb2, unwind: bb3];
|
||||
// }
|
||||
//
|
||||
// bb1 (cleanup): {
|
||||
// resume;
|
||||
// }
|
||||
//
|
||||
// bb2: {
|
||||
// _1 = move _2;
|
||||
// drop(_2) -> bb4;
|
||||
// }
|
||||
//
|
||||
// bb3 (cleanup): {
|
||||
// drop(_2) -> bb1;
|
||||
// }
|
||||
//
|
||||
// bb4: {
|
||||
// StorageDead(_2);
|
||||
// StorageLive(_3);
|
||||
// StorageLive(_4);
|
||||
// _4 = move _1;
|
||||
// _3 = const std::mem::drop::<std::boxed::Box<S>>(move _4) -> [return: bb5, unwind: bb7];
|
||||
// }
|
||||
//
|
||||
// bb5: {
|
||||
// StorageDead(_4);
|
||||
// StorageDead(_3);
|
||||
// _0 = ();
|
||||
// drop(_1) -> bb8;
|
||||
// }
|
||||
// bb6 (cleanup): {
|
||||
// drop(_1) -> bb1;
|
||||
// }
|
||||
// bb7 (cleanup): {
|
||||
// drop(_4) -> bb6;
|
||||
// }
|
||||
// bb8: {
|
||||
// StorageDead(_1);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// END rustc.main.ElaborateDrops.before.mir
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
// MIR for `main` before ElaborateDrops
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/box_expr.rs:6:11: 6:11
|
||||
let _1: std::boxed::Box<S>; // in scope 0 at $DIR/box_expr.rs:7:9: 7:10
|
||||
let mut _2: std::boxed::Box<S>; // in scope 0 at $DIR/box_expr.rs:7:13: 7:25
|
||||
let _3: (); // in scope 0 at $DIR/box_expr.rs:8:5: 8:12
|
||||
let mut _4: std::boxed::Box<S>; // in scope 0 at $DIR/box_expr.rs:8:10: 8:11
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/box_expr.rs:7:9: 7:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/box_expr.rs:7:9: 7:10
|
||||
StorageLive(_2); // bb0[1]: scope 0 at $DIR/box_expr.rs:7:13: 7:25
|
||||
_2 = Box(S); // bb0[2]: scope 0 at $DIR/box_expr.rs:7:13: 7:25
|
||||
(*_2) = const S::new() -> [return: bb2, unwind: bb3]; // bb0[3]: scope 0 at $DIR/box_expr.rs:7:17: 7:25
|
||||
// ty::Const
|
||||
// + ty: fn() -> S {S::new}
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $DIR/box_expr.rs:7:17: 7:23
|
||||
// + literal: Const { ty: fn() -> S {S::new}, val: Value(Scalar(<ZST>)) }
|
||||
}
|
||||
|
||||
bb1 (cleanup): {
|
||||
resume; // bb1[0]: scope 0 at $DIR/box_expr.rs:6:1: 9:2
|
||||
}
|
||||
|
||||
bb2: {
|
||||
_1 = move _2; // bb2[0]: scope 0 at $DIR/box_expr.rs:7:13: 7:25
|
||||
drop(_2) -> bb4; // bb2[1]: scope 0 at $DIR/box_expr.rs:7:24: 7:25
|
||||
}
|
||||
|
||||
bb3 (cleanup): {
|
||||
drop(_2) -> bb1; // bb3[0]: scope 0 at $DIR/box_expr.rs:7:24: 7:25
|
||||
}
|
||||
|
||||
bb4: {
|
||||
StorageDead(_2); // bb4[0]: scope 0 at $DIR/box_expr.rs:7:24: 7:25
|
||||
StorageLive(_3); // bb4[1]: scope 1 at $DIR/box_expr.rs:8:5: 8:12
|
||||
StorageLive(_4); // bb4[2]: scope 1 at $DIR/box_expr.rs:8:10: 8:11
|
||||
_4 = move _1; // bb4[3]: scope 1 at $DIR/box_expr.rs:8:10: 8:11
|
||||
_3 = const std::mem::drop::<std::boxed::Box<S>>(move _4) -> [return: bb5, unwind: bb7]; // bb4[4]: scope 1 at $DIR/box_expr.rs:8:5: 8:12
|
||||
// ty::Const
|
||||
// + ty: fn(std::boxed::Box<S>) {std::mem::drop::<std::boxed::Box<S>>}
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $DIR/box_expr.rs:8:5: 8:9
|
||||
// + literal: Const { ty: fn(std::boxed::Box<S>) {std::mem::drop::<std::boxed::Box<S>>}, val: Value(Scalar(<ZST>)) }
|
||||
}
|
||||
|
||||
bb5: {
|
||||
StorageDead(_4); // bb5[0]: scope 1 at $DIR/box_expr.rs:8:11: 8:12
|
||||
StorageDead(_3); // bb5[1]: scope 1 at $DIR/box_expr.rs:8:12: 8:13
|
||||
_0 = (); // bb5[2]: scope 0 at $DIR/box_expr.rs:6:11: 9:2
|
||||
drop(_1) -> bb8; // bb5[3]: scope 0 at $DIR/box_expr.rs:9:1: 9:2
|
||||
}
|
||||
|
||||
bb6 (cleanup): {
|
||||
drop(_1) -> bb1; // bb6[0]: scope 0 at $DIR/box_expr.rs:9:1: 9:2
|
||||
}
|
||||
|
||||
bb7 (cleanup): {
|
||||
drop(_4) -> bb6; // bb7[0]: scope 1 at $DIR/box_expr.rs:8:11: 8:12
|
||||
}
|
||||
|
||||
bb8: {
|
||||
StorageDead(_1); // bb8[0]: scope 0 at $DIR/box_expr.rs:9:1: 9:2
|
||||
return; // bb8[1]: scope 0 at $DIR/box_expr.rs:9:2: 9:2
|
||||
}
|
||||
}
|
|
@ -1,15 +1,7 @@
|
|||
// compile-flags: -Z mir-opt-level=0
|
||||
|
||||
// EMIT_MIR rustc.main.SimplifyCfg-elaborate-drops.after.mir
|
||||
fn main() {
|
||||
let x = b"foo";
|
||||
let y = [5u8, b'x'];
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
// START rustc.main.SimplifyCfg-elaborate-drops.after.mir
|
||||
// ...
|
||||
// _1 = const b"foo";
|
||||
// ...
|
||||
// _2 = [const 5u8, const 120u8];
|
||||
// ...
|
||||
// END rustc.main.SimplifyCfg-elaborate-drops.after.mir
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
// MIR for `main` after SimplifyCfg-elaborate-drops
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/byte_slice.rs:4:11: 4:11
|
||||
let _1: &[u8; 3]; // in scope 0 at $DIR/byte_slice.rs:5:9: 5:10
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/byte_slice.rs:5:9: 5:10
|
||||
let _2: [u8; 2]; // in scope 1 at $DIR/byte_slice.rs:6:9: 6:10
|
||||
scope 2 {
|
||||
debug y => _2; // in scope 2 at $DIR/byte_slice.rs:6:9: 6:10
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/byte_slice.rs:5:9: 5:10
|
||||
_1 = const b"foo"; // bb0[1]: scope 0 at $DIR/byte_slice.rs:5:13: 5:19
|
||||
// ty::Const
|
||||
// + ty: &[u8; 3]
|
||||
// + val: Value(Scalar(alloc0+0))
|
||||
// mir::Constant
|
||||
// + span: $DIR/byte_slice.rs:5:13: 5:19
|
||||
// + literal: Const { ty: &[u8; 3], val: Value(Scalar(alloc0+0)) }
|
||||
StorageLive(_2); // bb0[2]: scope 1 at $DIR/byte_slice.rs:6:9: 6:10
|
||||
_2 = [const 5u8, const 120u8]; // bb0[3]: scope 1 at $DIR/byte_slice.rs:6:13: 6:24
|
||||
// ty::Const
|
||||
// + ty: u8
|
||||
// + val: Value(Scalar(0x05))
|
||||
// mir::Constant
|
||||
// + span: $DIR/byte_slice.rs:6:14: 6:17
|
||||
// + literal: Const { ty: u8, val: Value(Scalar(0x05)) }
|
||||
// ty::Const
|
||||
// + ty: u8
|
||||
// + val: Value(Scalar(0x78))
|
||||
// mir::Constant
|
||||
// + span: $DIR/byte_slice.rs:6:19: 6:23
|
||||
// + literal: Const { ty: u8, val: Value(Scalar(0x78)) }
|
||||
_0 = (); // bb0[4]: scope 0 at $DIR/byte_slice.rs:4:11: 7:2
|
||||
StorageDead(_2); // bb0[5]: scope 1 at $DIR/byte_slice.rs:7:1: 7:2
|
||||
StorageDead(_1); // bb0[6]: scope 0 at $DIR/byte_slice.rs:7:1: 7:2
|
||||
return; // bb0[7]: scope 0 at $DIR/byte_slice.rs:7:2: 7:2
|
||||
}
|
||||
}
|
||||
|
||||
alloc0 (size: 3, align: 1) {
|
||||
66 6f 6f │ foo
|
||||
}
|
|
@ -1,3 +1,6 @@
|
|||
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
||||
// EMIT_MIR rustc.norm2.InstCombine.diff
|
||||
|
||||
fn norm2(x: [f32; 2]) -> f32 {
|
||||
let a = x[0];
|
||||
let b = x[1];
|
||||
|
@ -7,17 +10,3 @@ fn norm2(x: [f32; 2]) -> f32 {
|
|||
fn main() {
|
||||
assert_eq!(norm2([3.0, 4.0]), 5.0*5.0);
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
|
||||
// START rustc.norm2.InstCombine.before.mir
|
||||
// _4 = Len(_1);
|
||||
// ...
|
||||
// _8 = Len(_1);
|
||||
// END rustc.norm2.InstCombine.before.mir
|
||||
|
||||
// START rustc.norm2.InstCombine.after.mir
|
||||
// _4 = const 2usize;
|
||||
// ...
|
||||
// _8 = const 2usize;
|
||||
// END rustc.norm2.InstCombine.after.mir
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
- // MIR for `norm2` before InstCombine
|
||||
+ // MIR for `norm2` after InstCombine
|
||||
|
||||
fn norm2(_1: [f32; 2]) -> f32 {
|
||||
debug x => _1; // in scope 0 at $DIR/combine_array_len.rs:4:10: 4:11
|
||||
let mut _0: f32; // return place in scope 0 at $DIR/combine_array_len.rs:4:26: 4:29
|
||||
let _2: f32; // in scope 0 at $DIR/combine_array_len.rs:5:9: 5:10
|
||||
let _3: usize; // in scope 0 at $DIR/combine_array_len.rs:5:15: 5:16
|
||||
let mut _4: usize; // in scope 0 at $DIR/combine_array_len.rs:5:13: 5:17
|
||||
let mut _5: bool; // in scope 0 at $DIR/combine_array_len.rs:5:13: 5:17
|
||||
let _7: usize; // in scope 0 at $DIR/combine_array_len.rs:6:15: 6:16
|
||||
let mut _8: usize; // in scope 0 at $DIR/combine_array_len.rs:6:13: 6:17
|
||||
let mut _9: bool; // in scope 0 at $DIR/combine_array_len.rs:6:13: 6:17
|
||||
let mut _10: f32; // in scope 0 at $DIR/combine_array_len.rs:7:5: 7:8
|
||||
let mut _11: f32; // in scope 0 at $DIR/combine_array_len.rs:7:5: 7:6
|
||||
let mut _12: f32; // in scope 0 at $DIR/combine_array_len.rs:7:7: 7:8
|
||||
let mut _13: f32; // in scope 0 at $DIR/combine_array_len.rs:7:11: 7:14
|
||||
let mut _14: f32; // in scope 0 at $DIR/combine_array_len.rs:7:11: 7:12
|
||||
let mut _15: f32; // in scope 0 at $DIR/combine_array_len.rs:7:13: 7:14
|
||||
scope 1 {
|
||||
debug a => _2; // in scope 1 at $DIR/combine_array_len.rs:5:9: 5:10
|
||||
let _6: f32; // in scope 1 at $DIR/combine_array_len.rs:6:9: 6:10
|
||||
scope 2 {
|
||||
debug b => _6; // in scope 2 at $DIR/combine_array_len.rs:6:9: 6:10
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_2); // bb0[0]: scope 0 at $DIR/combine_array_len.rs:5:9: 5:10
|
||||
StorageLive(_3); // bb0[1]: scope 0 at $DIR/combine_array_len.rs:5:15: 5:16
|
||||
_3 = const 0usize; // bb0[2]: scope 0 at $DIR/combine_array_len.rs:5:15: 5:16
|
||||
// ty::Const
|
||||
// + ty: usize
|
||||
// + val: Value(Scalar(0x00000000))
|
||||
// mir::Constant
|
||||
// + span: $DIR/combine_array_len.rs:5:15: 5:16
|
||||
// + literal: Const { ty: usize, val: Value(Scalar(0x00000000)) }
|
||||
- _4 = Len(_1); // bb0[3]: scope 0 at $DIR/combine_array_len.rs:5:13: 5:17
|
||||
+ _4 = const 2usize; // bb0[3]: scope 0 at $DIR/combine_array_len.rs:5:13: 5:17
|
||||
+ // ty::Const
|
||||
+ // + ty: usize
|
||||
+ // + val: Value(Scalar(0x00000002))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/combine_array_len.rs:5:13: 5:17
|
||||
+ // + literal: Const { ty: usize, val: Value(Scalar(0x00000002)) }
|
||||
_5 = Lt(_3, _4); // bb0[4]: scope 0 at $DIR/combine_array_len.rs:5:13: 5:17
|
||||
assert(move _5, "index out of bounds: the len is move _4 but the index is _3") -> bb1; // bb0[5]: scope 0 at $DIR/combine_array_len.rs:5:13: 5:17
|
||||
}
|
||||
|
||||
bb1: {
|
||||
_2 = _1[_3]; // bb1[0]: scope 0 at $DIR/combine_array_len.rs:5:13: 5:17
|
||||
StorageDead(_3); // bb1[1]: scope 0 at $DIR/combine_array_len.rs:5:17: 5:18
|
||||
StorageLive(_6); // bb1[2]: scope 1 at $DIR/combine_array_len.rs:6:9: 6:10
|
||||
StorageLive(_7); // bb1[3]: scope 1 at $DIR/combine_array_len.rs:6:15: 6:16
|
||||
_7 = const 1usize; // bb1[4]: scope 1 at $DIR/combine_array_len.rs:6:15: 6:16
|
||||
// ty::Const
|
||||
// + ty: usize
|
||||
// + val: Value(Scalar(0x00000001))
|
||||
// mir::Constant
|
||||
// + span: $DIR/combine_array_len.rs:6:15: 6:16
|
||||
// + literal: Const { ty: usize, val: Value(Scalar(0x00000001)) }
|
||||
- _8 = Len(_1); // bb1[5]: scope 1 at $DIR/combine_array_len.rs:6:13: 6:17
|
||||
+ _8 = const 2usize; // bb1[5]: scope 1 at $DIR/combine_array_len.rs:6:13: 6:17
|
||||
+ // ty::Const
|
||||
+ // + ty: usize
|
||||
+ // + val: Value(Scalar(0x00000002))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/combine_array_len.rs:6:13: 6:17
|
||||
+ // + literal: Const { ty: usize, val: Value(Scalar(0x00000002)) }
|
||||
_9 = Lt(_7, _8); // bb1[6]: scope 1 at $DIR/combine_array_len.rs:6:13: 6:17
|
||||
assert(move _9, "index out of bounds: the len is move _8 but the index is _7") -> bb2; // bb1[7]: scope 1 at $DIR/combine_array_len.rs:6:13: 6:17
|
||||
}
|
||||
|
||||
bb2: {
|
||||
_6 = _1[_7]; // bb2[0]: scope 1 at $DIR/combine_array_len.rs:6:13: 6:17
|
||||
StorageDead(_7); // bb2[1]: scope 1 at $DIR/combine_array_len.rs:6:17: 6:18
|
||||
StorageLive(_10); // bb2[2]: scope 2 at $DIR/combine_array_len.rs:7:5: 7:8
|
||||
StorageLive(_11); // bb2[3]: scope 2 at $DIR/combine_array_len.rs:7:5: 7:6
|
||||
_11 = _2; // bb2[4]: scope 2 at $DIR/combine_array_len.rs:7:5: 7:6
|
||||
StorageLive(_12); // bb2[5]: scope 2 at $DIR/combine_array_len.rs:7:7: 7:8
|
||||
_12 = _2; // bb2[6]: scope 2 at $DIR/combine_array_len.rs:7:7: 7:8
|
||||
_10 = Mul(move _11, move _12); // bb2[7]: scope 2 at $DIR/combine_array_len.rs:7:5: 7:8
|
||||
StorageDead(_12); // bb2[8]: scope 2 at $DIR/combine_array_len.rs:7:7: 7:8
|
||||
StorageDead(_11); // bb2[9]: scope 2 at $DIR/combine_array_len.rs:7:7: 7:8
|
||||
StorageLive(_13); // bb2[10]: scope 2 at $DIR/combine_array_len.rs:7:11: 7:14
|
||||
StorageLive(_14); // bb2[11]: scope 2 at $DIR/combine_array_len.rs:7:11: 7:12
|
||||
_14 = _6; // bb2[12]: scope 2 at $DIR/combine_array_len.rs:7:11: 7:12
|
||||
StorageLive(_15); // bb2[13]: scope 2 at $DIR/combine_array_len.rs:7:13: 7:14
|
||||
_15 = _6; // bb2[14]: scope 2 at $DIR/combine_array_len.rs:7:13: 7:14
|
||||
_13 = Mul(move _14, move _15); // bb2[15]: scope 2 at $DIR/combine_array_len.rs:7:11: 7:14
|
||||
StorageDead(_15); // bb2[16]: scope 2 at $DIR/combine_array_len.rs:7:13: 7:14
|
||||
StorageDead(_14); // bb2[17]: scope 2 at $DIR/combine_array_len.rs:7:13: 7:14
|
||||
_0 = Add(move _10, move _13); // bb2[18]: scope 2 at $DIR/combine_array_len.rs:7:5: 7:14
|
||||
StorageDead(_13); // bb2[19]: scope 2 at $DIR/combine_array_len.rs:7:13: 7:14
|
||||
StorageDead(_10); // bb2[20]: scope 2 at $DIR/combine_array_len.rs:7:13: 7:14
|
||||
StorageDead(_6); // bb2[21]: scope 1 at $DIR/combine_array_len.rs:8:1: 8:2
|
||||
StorageDead(_2); // bb2[22]: scope 0 at $DIR/combine_array_len.rs:8:1: 8:2
|
||||
return; // bb2[23]: scope 0 at $DIR/combine_array_len.rs:8:2: 8:2
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
- // MIR for `norm2` before InstCombine
|
||||
+ // MIR for `norm2` after InstCombine
|
||||
|
||||
fn norm2(_1: [f32; 2]) -> f32 {
|
||||
debug x => _1; // in scope 0 at $DIR/combine_array_len.rs:4:10: 4:11
|
||||
let mut _0: f32; // return place in scope 0 at $DIR/combine_array_len.rs:4:26: 4:29
|
||||
let _2: f32; // in scope 0 at $DIR/combine_array_len.rs:5:9: 5:10
|
||||
let _3: usize; // in scope 0 at $DIR/combine_array_len.rs:5:15: 5:16
|
||||
let mut _4: usize; // in scope 0 at $DIR/combine_array_len.rs:5:13: 5:17
|
||||
let mut _5: bool; // in scope 0 at $DIR/combine_array_len.rs:5:13: 5:17
|
||||
let _7: usize; // in scope 0 at $DIR/combine_array_len.rs:6:15: 6:16
|
||||
let mut _8: usize; // in scope 0 at $DIR/combine_array_len.rs:6:13: 6:17
|
||||
let mut _9: bool; // in scope 0 at $DIR/combine_array_len.rs:6:13: 6:17
|
||||
let mut _10: f32; // in scope 0 at $DIR/combine_array_len.rs:7:5: 7:8
|
||||
let mut _11: f32; // in scope 0 at $DIR/combine_array_len.rs:7:5: 7:6
|
||||
let mut _12: f32; // in scope 0 at $DIR/combine_array_len.rs:7:7: 7:8
|
||||
let mut _13: f32; // in scope 0 at $DIR/combine_array_len.rs:7:11: 7:14
|
||||
let mut _14: f32; // in scope 0 at $DIR/combine_array_len.rs:7:11: 7:12
|
||||
let mut _15: f32; // in scope 0 at $DIR/combine_array_len.rs:7:13: 7:14
|
||||
scope 1 {
|
||||
debug a => _2; // in scope 1 at $DIR/combine_array_len.rs:5:9: 5:10
|
||||
let _6: f32; // in scope 1 at $DIR/combine_array_len.rs:6:9: 6:10
|
||||
scope 2 {
|
||||
debug b => _6; // in scope 2 at $DIR/combine_array_len.rs:6:9: 6:10
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_2); // bb0[0]: scope 0 at $DIR/combine_array_len.rs:5:9: 5:10
|
||||
StorageLive(_3); // bb0[1]: scope 0 at $DIR/combine_array_len.rs:5:15: 5:16
|
||||
_3 = const 0usize; // bb0[2]: scope 0 at $DIR/combine_array_len.rs:5:15: 5:16
|
||||
// ty::Const
|
||||
// + ty: usize
|
||||
// + val: Value(Scalar(0x0000000000000000))
|
||||
// mir::Constant
|
||||
// + span: $DIR/combine_array_len.rs:5:15: 5:16
|
||||
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000000)) }
|
||||
- _4 = Len(_1); // bb0[3]: scope 0 at $DIR/combine_array_len.rs:5:13: 5:17
|
||||
+ _4 = const 2usize; // bb0[3]: scope 0 at $DIR/combine_array_len.rs:5:13: 5:17
|
||||
+ // ty::Const
|
||||
+ // + ty: usize
|
||||
+ // + val: Value(Scalar(0x0000000000000002))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/combine_array_len.rs:5:13: 5:17
|
||||
+ // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000002)) }
|
||||
_5 = Lt(_3, _4); // bb0[4]: scope 0 at $DIR/combine_array_len.rs:5:13: 5:17
|
||||
assert(move _5, "index out of bounds: the len is move _4 but the index is _3") -> bb1; // bb0[5]: scope 0 at $DIR/combine_array_len.rs:5:13: 5:17
|
||||
}
|
||||
|
||||
bb1: {
|
||||
_2 = _1[_3]; // bb1[0]: scope 0 at $DIR/combine_array_len.rs:5:13: 5:17
|
||||
StorageDead(_3); // bb1[1]: scope 0 at $DIR/combine_array_len.rs:5:17: 5:18
|
||||
StorageLive(_6); // bb1[2]: scope 1 at $DIR/combine_array_len.rs:6:9: 6:10
|
||||
StorageLive(_7); // bb1[3]: scope 1 at $DIR/combine_array_len.rs:6:15: 6:16
|
||||
_7 = const 1usize; // bb1[4]: scope 1 at $DIR/combine_array_len.rs:6:15: 6:16
|
||||
// ty::Const
|
||||
// + ty: usize
|
||||
// + val: Value(Scalar(0x0000000000000001))
|
||||
// mir::Constant
|
||||
// + span: $DIR/combine_array_len.rs:6:15: 6:16
|
||||
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) }
|
||||
- _8 = Len(_1); // bb1[5]: scope 1 at $DIR/combine_array_len.rs:6:13: 6:17
|
||||
+ _8 = const 2usize; // bb1[5]: scope 1 at $DIR/combine_array_len.rs:6:13: 6:17
|
||||
+ // ty::Const
|
||||
+ // + ty: usize
|
||||
+ // + val: Value(Scalar(0x0000000000000002))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/combine_array_len.rs:6:13: 6:17
|
||||
+ // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000002)) }
|
||||
_9 = Lt(_7, _8); // bb1[6]: scope 1 at $DIR/combine_array_len.rs:6:13: 6:17
|
||||
assert(move _9, "index out of bounds: the len is move _8 but the index is _7") -> bb2; // bb1[7]: scope 1 at $DIR/combine_array_len.rs:6:13: 6:17
|
||||
}
|
||||
|
||||
bb2: {
|
||||
_6 = _1[_7]; // bb2[0]: scope 1 at $DIR/combine_array_len.rs:6:13: 6:17
|
||||
StorageDead(_7); // bb2[1]: scope 1 at $DIR/combine_array_len.rs:6:17: 6:18
|
||||
StorageLive(_10); // bb2[2]: scope 2 at $DIR/combine_array_len.rs:7:5: 7:8
|
||||
StorageLive(_11); // bb2[3]: scope 2 at $DIR/combine_array_len.rs:7:5: 7:6
|
||||
_11 = _2; // bb2[4]: scope 2 at $DIR/combine_array_len.rs:7:5: 7:6
|
||||
StorageLive(_12); // bb2[5]: scope 2 at $DIR/combine_array_len.rs:7:7: 7:8
|
||||
_12 = _2; // bb2[6]: scope 2 at $DIR/combine_array_len.rs:7:7: 7:8
|
||||
_10 = Mul(move _11, move _12); // bb2[7]: scope 2 at $DIR/combine_array_len.rs:7:5: 7:8
|
||||
StorageDead(_12); // bb2[8]: scope 2 at $DIR/combine_array_len.rs:7:7: 7:8
|
||||
StorageDead(_11); // bb2[9]: scope 2 at $DIR/combine_array_len.rs:7:7: 7:8
|
||||
StorageLive(_13); // bb2[10]: scope 2 at $DIR/combine_array_len.rs:7:11: 7:14
|
||||
StorageLive(_14); // bb2[11]: scope 2 at $DIR/combine_array_len.rs:7:11: 7:12
|
||||
_14 = _6; // bb2[12]: scope 2 at $DIR/combine_array_len.rs:7:11: 7:12
|
||||
StorageLive(_15); // bb2[13]: scope 2 at $DIR/combine_array_len.rs:7:13: 7:14
|
||||
_15 = _6; // bb2[14]: scope 2 at $DIR/combine_array_len.rs:7:13: 7:14
|
||||
_13 = Mul(move _14, move _15); // bb2[15]: scope 2 at $DIR/combine_array_len.rs:7:11: 7:14
|
||||
StorageDead(_15); // bb2[16]: scope 2 at $DIR/combine_array_len.rs:7:13: 7:14
|
||||
StorageDead(_14); // bb2[17]: scope 2 at $DIR/combine_array_len.rs:7:13: 7:14
|
||||
_0 = Add(move _10, move _13); // bb2[18]: scope 2 at $DIR/combine_array_len.rs:7:5: 7:14
|
||||
StorageDead(_13); // bb2[19]: scope 2 at $DIR/combine_array_len.rs:7:13: 7:14
|
||||
StorageDead(_10); // bb2[20]: scope 2 at $DIR/combine_array_len.rs:7:13: 7:14
|
||||
StorageDead(_6); // bb2[21]: scope 1 at $DIR/combine_array_len.rs:8:1: 8:2
|
||||
StorageDead(_2); // bb2[22]: scope 0 at $DIR/combine_array_len.rs:8:1: 8:2
|
||||
return; // bb2[23]: scope 0 at $DIR/combine_array_len.rs:8:2: 8:2
|
||||
}
|
||||
}
|
||||
|
|
@ -1,25 +1,6 @@
|
|||
// compile-flags: -O
|
||||
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
fn main() {
|
||||
let x = (0, 1, 2).1 + 0;
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
// START rustc.main.ConstProp.before.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _3 = (const 0i32, const 1i32, const 2i32);
|
||||
// _2 = (_3.1: i32);
|
||||
// _1 = Add(move _2, const 0i32);
|
||||
// ...
|
||||
// }
|
||||
// END rustc.main.ConstProp.before.mir
|
||||
// START rustc.main.ConstProp.after.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _3 = (const 0i32, const 1i32, const 2i32);
|
||||
// _2 = const 1i32;
|
||||
// _1 = const 1i32;
|
||||
// ...
|
||||
// }
|
||||
// END rustc.main.ConstProp.after.mir
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/aggregate.rs:4:11: 4:11
|
||||
let _1: i32; // in scope 0 at $DIR/aggregate.rs:5:9: 5:10
|
||||
let mut _2: i32; // in scope 0 at $DIR/aggregate.rs:5:13: 5:24
|
||||
let mut _3: (i32, i32, i32); // in scope 0 at $DIR/aggregate.rs:5:13: 5:22
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/aggregate.rs:5:9: 5:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/aggregate.rs:5:9: 5:10
|
||||
StorageLive(_2); // bb0[1]: scope 0 at $DIR/aggregate.rs:5:13: 5:24
|
||||
StorageLive(_3); // bb0[2]: scope 0 at $DIR/aggregate.rs:5:13: 5:22
|
||||
_3 = (const 0i32, const 1i32, const 2i32); // bb0[3]: scope 0 at $DIR/aggregate.rs:5:13: 5:22
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000000))
|
||||
// mir::Constant
|
||||
// + span: $DIR/aggregate.rs:5:14: 5:15
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000000)) }
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000001))
|
||||
// mir::Constant
|
||||
// + span: $DIR/aggregate.rs:5:17: 5:18
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) }
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000002))
|
||||
// mir::Constant
|
||||
// + span: $DIR/aggregate.rs:5:20: 5:21
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) }
|
||||
- _2 = (_3.1: i32); // bb0[4]: scope 0 at $DIR/aggregate.rs:5:13: 5:24
|
||||
- _1 = Add(move _2, const 0i32); // bb0[5]: scope 0 at $DIR/aggregate.rs:5:13: 5:28
|
||||
+ _2 = const 1i32; // bb0[4]: scope 0 at $DIR/aggregate.rs:5:13: 5:24
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
- // + val: Value(Scalar(0x00000000))
|
||||
+ // + val: Value(Scalar(0x00000001))
|
||||
// mir::Constant
|
||||
- // + span: $DIR/aggregate.rs:5:27: 5:28
|
||||
- // + literal: Const { ty: i32, val: Value(Scalar(0x00000000)) }
|
||||
+ // + span: $DIR/aggregate.rs:5:13: 5:24
|
||||
+ // + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) }
|
||||
+ _1 = const 1i32; // bb0[5]: scope 0 at $DIR/aggregate.rs:5:13: 5:28
|
||||
+ // ty::Const
|
||||
+ // + ty: i32
|
||||
+ // + val: Value(Scalar(0x00000001))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/aggregate.rs:5:13: 5:28
|
||||
+ // + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) }
|
||||
StorageDead(_2); // bb0[6]: scope 0 at $DIR/aggregate.rs:5:27: 5:28
|
||||
StorageDead(_3); // bb0[7]: scope 0 at $DIR/aggregate.rs:5:28: 5:29
|
||||
_0 = (); // bb0[8]: scope 0 at $DIR/aggregate.rs:4:11: 6:2
|
||||
StorageDead(_1); // bb0[9]: scope 0 at $DIR/aggregate.rs:6:1: 6:2
|
||||
return; // bb0[10]: scope 0 at $DIR/aggregate.rs:6:2: 6:2
|
||||
}
|
||||
}
|
||||
|
|
@ -1,33 +1,6 @@
|
|||
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
||||
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
fn main() {
|
||||
let x: u32 = [0, 1, 2, 3][2];
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
// START rustc.main.ConstProp.before.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _2 = [const 0u32, const 1u32, const 2u32, const 3u32];
|
||||
// ...
|
||||
// _3 = const 2usize;
|
||||
// _4 = const 4usize;
|
||||
// _5 = Lt(_3, _4);
|
||||
// assert(move _5, "index out of bounds: the len is move _4 but the index is _3") -> bb1;
|
||||
// }
|
||||
// bb1: {
|
||||
// _1 = _2[_3];
|
||||
// ...
|
||||
// return;
|
||||
// }
|
||||
// END rustc.main.ConstProp.before.mir
|
||||
// START rustc.main.ConstProp.after.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _5 = const true;
|
||||
// assert(const true, "index out of bounds: the len is move _4 but the index is _3") -> bb1;
|
||||
// }
|
||||
// bb1: {
|
||||
// _1 = const 2u32;
|
||||
// ...
|
||||
// return;
|
||||
// }
|
||||
// END rustc.main.ConstProp.after.mir
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/array_index.rs:4:11: 4:11
|
||||
let _1: u32 as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 0 at $DIR/array_index.rs:5:9: 5:10
|
||||
let mut _2: [u32; 4]; // in scope 0 at $DIR/array_index.rs:5:18: 5:30
|
||||
let _3: usize; // in scope 0 at $DIR/array_index.rs:5:31: 5:32
|
||||
let mut _4: usize; // in scope 0 at $DIR/array_index.rs:5:18: 5:33
|
||||
let mut _5: bool; // in scope 0 at $DIR/array_index.rs:5:18: 5:33
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/array_index.rs:5:9: 5:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/array_index.rs:5:9: 5:10
|
||||
StorageLive(_2); // bb0[1]: scope 0 at $DIR/array_index.rs:5:18: 5:30
|
||||
_2 = [const 0u32, const 1u32, const 2u32, const 3u32]; // bb0[2]: scope 0 at $DIR/array_index.rs:5:18: 5:30
|
||||
// ty::Const
|
||||
// + ty: u32
|
||||
// + val: Value(Scalar(0x00000000))
|
||||
// mir::Constant
|
||||
// + span: $DIR/array_index.rs:5:19: 5:20
|
||||
// + literal: Const { ty: u32, val: Value(Scalar(0x00000000)) }
|
||||
// ty::Const
|
||||
// + ty: u32
|
||||
// + val: Value(Scalar(0x00000001))
|
||||
// mir::Constant
|
||||
// + span: $DIR/array_index.rs:5:22: 5:23
|
||||
// + literal: Const { ty: u32, val: Value(Scalar(0x00000001)) }
|
||||
// ty::Const
|
||||
// + ty: u32
|
||||
// + val: Value(Scalar(0x00000002))
|
||||
// mir::Constant
|
||||
// + span: $DIR/array_index.rs:5:25: 5:26
|
||||
// + literal: Const { ty: u32, val: Value(Scalar(0x00000002)) }
|
||||
// ty::Const
|
||||
// + ty: u32
|
||||
// + val: Value(Scalar(0x00000003))
|
||||
// mir::Constant
|
||||
// + span: $DIR/array_index.rs:5:28: 5:29
|
||||
// + literal: Const { ty: u32, val: Value(Scalar(0x00000003)) }
|
||||
StorageLive(_3); // bb0[3]: scope 0 at $DIR/array_index.rs:5:31: 5:32
|
||||
_3 = const 2usize; // bb0[4]: scope 0 at $DIR/array_index.rs:5:31: 5:32
|
||||
// ty::Const
|
||||
// + ty: usize
|
||||
// + val: Value(Scalar(0x00000002))
|
||||
// mir::Constant
|
||||
// + span: $DIR/array_index.rs:5:31: 5:32
|
||||
// + literal: Const { ty: usize, val: Value(Scalar(0x00000002)) }
|
||||
_4 = const 4usize; // bb0[5]: scope 0 at $DIR/array_index.rs:5:18: 5:33
|
||||
// ty::Const
|
||||
// + ty: usize
|
||||
// + val: Value(Scalar(0x00000004))
|
||||
// mir::Constant
|
||||
// + span: $DIR/array_index.rs:5:18: 5:33
|
||||
// + literal: Const { ty: usize, val: Value(Scalar(0x00000004)) }
|
||||
- _5 = Lt(_3, _4); // bb0[6]: scope 0 at $DIR/array_index.rs:5:18: 5:33
|
||||
- assert(move _5, "index out of bounds: the len is move _4 but the index is _3") -> bb1; // bb0[7]: scope 0 at $DIR/array_index.rs:5:18: 5:33
|
||||
+ _5 = const true; // bb0[6]: scope 0 at $DIR/array_index.rs:5:18: 5:33
|
||||
+ // ty::Const
|
||||
+ // + ty: bool
|
||||
+ // + val: Value(Scalar(0x01))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/array_index.rs:5:18: 5:33
|
||||
+ // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
|
||||
+ assert(const true, "index out of bounds: the len is move _4 but the index is _3") -> bb1; // bb0[7]: scope 0 at $DIR/array_index.rs:5:18: 5:33
|
||||
+ // ty::Const
|
||||
+ // + ty: bool
|
||||
+ // + val: Value(Scalar(0x01))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/array_index.rs:5:18: 5:33
|
||||
+ // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
- _1 = _2[_3]; // bb1[0]: scope 0 at $DIR/array_index.rs:5:18: 5:33
|
||||
+ _1 = const 2u32; // bb1[0]: scope 0 at $DIR/array_index.rs:5:18: 5:33
|
||||
+ // ty::Const
|
||||
+ // + ty: u32
|
||||
+ // + val: Value(Scalar(0x00000002))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/array_index.rs:5:18: 5:33
|
||||
+ // + literal: Const { ty: u32, val: Value(Scalar(0x00000002)) }
|
||||
StorageDead(_3); // bb1[1]: scope 0 at $DIR/array_index.rs:5:33: 5:34
|
||||
StorageDead(_2); // bb1[2]: scope 0 at $DIR/array_index.rs:5:33: 5:34
|
||||
_0 = (); // bb1[3]: scope 0 at $DIR/array_index.rs:4:11: 6:2
|
||||
StorageDead(_1); // bb1[4]: scope 0 at $DIR/array_index.rs:6:1: 6:2
|
||||
return; // bb1[5]: scope 0 at $DIR/array_index.rs:6:2: 6:2
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/array_index.rs:4:11: 4:11
|
||||
let _1: u32 as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 0 at $DIR/array_index.rs:5:9: 5:10
|
||||
let mut _2: [u32; 4]; // in scope 0 at $DIR/array_index.rs:5:18: 5:30
|
||||
let _3: usize; // in scope 0 at $DIR/array_index.rs:5:31: 5:32
|
||||
let mut _4: usize; // in scope 0 at $DIR/array_index.rs:5:18: 5:33
|
||||
let mut _5: bool; // in scope 0 at $DIR/array_index.rs:5:18: 5:33
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/array_index.rs:5:9: 5:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/array_index.rs:5:9: 5:10
|
||||
StorageLive(_2); // bb0[1]: scope 0 at $DIR/array_index.rs:5:18: 5:30
|
||||
_2 = [const 0u32, const 1u32, const 2u32, const 3u32]; // bb0[2]: scope 0 at $DIR/array_index.rs:5:18: 5:30
|
||||
// ty::Const
|
||||
// + ty: u32
|
||||
// + val: Value(Scalar(0x00000000))
|
||||
// mir::Constant
|
||||
// + span: $DIR/array_index.rs:5:19: 5:20
|
||||
// + literal: Const { ty: u32, val: Value(Scalar(0x00000000)) }
|
||||
// ty::Const
|
||||
// + ty: u32
|
||||
// + val: Value(Scalar(0x00000001))
|
||||
// mir::Constant
|
||||
// + span: $DIR/array_index.rs:5:22: 5:23
|
||||
// + literal: Const { ty: u32, val: Value(Scalar(0x00000001)) }
|
||||
// ty::Const
|
||||
// + ty: u32
|
||||
// + val: Value(Scalar(0x00000002))
|
||||
// mir::Constant
|
||||
// + span: $DIR/array_index.rs:5:25: 5:26
|
||||
// + literal: Const { ty: u32, val: Value(Scalar(0x00000002)) }
|
||||
// ty::Const
|
||||
// + ty: u32
|
||||
// + val: Value(Scalar(0x00000003))
|
||||
// mir::Constant
|
||||
// + span: $DIR/array_index.rs:5:28: 5:29
|
||||
// + literal: Const { ty: u32, val: Value(Scalar(0x00000003)) }
|
||||
StorageLive(_3); // bb0[3]: scope 0 at $DIR/array_index.rs:5:31: 5:32
|
||||
_3 = const 2usize; // bb0[4]: scope 0 at $DIR/array_index.rs:5:31: 5:32
|
||||
// ty::Const
|
||||
// + ty: usize
|
||||
// + val: Value(Scalar(0x0000000000000002))
|
||||
// mir::Constant
|
||||
// + span: $DIR/array_index.rs:5:31: 5:32
|
||||
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000002)) }
|
||||
_4 = const 4usize; // bb0[5]: scope 0 at $DIR/array_index.rs:5:18: 5:33
|
||||
// ty::Const
|
||||
// + ty: usize
|
||||
// + val: Value(Scalar(0x0000000000000004))
|
||||
// mir::Constant
|
||||
// + span: $DIR/array_index.rs:5:18: 5:33
|
||||
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000004)) }
|
||||
- _5 = Lt(_3, _4); // bb0[6]: scope 0 at $DIR/array_index.rs:5:18: 5:33
|
||||
- assert(move _5, "index out of bounds: the len is move _4 but the index is _3") -> bb1; // bb0[7]: scope 0 at $DIR/array_index.rs:5:18: 5:33
|
||||
+ _5 = const true; // bb0[6]: scope 0 at $DIR/array_index.rs:5:18: 5:33
|
||||
+ // ty::Const
|
||||
+ // + ty: bool
|
||||
+ // + val: Value(Scalar(0x01))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/array_index.rs:5:18: 5:33
|
||||
+ // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
|
||||
+ assert(const true, "index out of bounds: the len is move _4 but the index is _3") -> bb1; // bb0[7]: scope 0 at $DIR/array_index.rs:5:18: 5:33
|
||||
+ // ty::Const
|
||||
+ // + ty: bool
|
||||
+ // + val: Value(Scalar(0x01))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/array_index.rs:5:18: 5:33
|
||||
+ // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
- _1 = _2[_3]; // bb1[0]: scope 0 at $DIR/array_index.rs:5:18: 5:33
|
||||
+ _1 = const 2u32; // bb1[0]: scope 0 at $DIR/array_index.rs:5:18: 5:33
|
||||
+ // ty::Const
|
||||
+ // + ty: u32
|
||||
+ // + val: Value(Scalar(0x00000002))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/array_index.rs:5:18: 5:33
|
||||
+ // + literal: Const { ty: u32, val: Value(Scalar(0x00000002)) }
|
||||
StorageDead(_3); // bb1[1]: scope 0 at $DIR/array_index.rs:5:33: 5:34
|
||||
StorageDead(_2); // bb1[2]: scope 0 at $DIR/array_index.rs:5:33: 5:34
|
||||
_0 = (); // bb1[3]: scope 0 at $DIR/array_index.rs:4:11: 6:2
|
||||
StorageDead(_1); // bb1[4]: scope 0 at $DIR/array_index.rs:6:1: 6:2
|
||||
return; // bb1[5]: scope 0 at $DIR/array_index.rs:6:2: 6:2
|
||||
}
|
||||
}
|
||||
|
|
@ -7,50 +7,7 @@
|
|||
|
||||
// Note: this test verifies that we, in fact, do not const prop `box`
|
||||
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
fn main() {
|
||||
let x = *(box 42) + 0;
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
// START rustc.main.ConstProp.before.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _4 = Box(i32);
|
||||
// (*_4) = const 42i32;
|
||||
// _3 = move _4;
|
||||
// ...
|
||||
// _2 = (*_3);
|
||||
// _1 = Add(move _2, const 0i32);
|
||||
// ...
|
||||
// drop(_3) -> [return: bb2, unwind: bb1];
|
||||
// }
|
||||
// bb1 (cleanup): {
|
||||
// resume;
|
||||
// }
|
||||
// bb2: {
|
||||
// ...
|
||||
// _0 = ();
|
||||
// ...
|
||||
// }
|
||||
// END rustc.main.ConstProp.before.mir
|
||||
// START rustc.main.ConstProp.after.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _4 = Box(i32);
|
||||
// (*_4) = const 42i32;
|
||||
// _3 = move _4;
|
||||
// ...
|
||||
// _2 = (*_3);
|
||||
// _1 = Add(move _2, const 0i32);
|
||||
// ...
|
||||
// drop(_3) -> [return: bb2, unwind: bb1];
|
||||
// }
|
||||
// bb1 (cleanup): {
|
||||
// resume;
|
||||
// }
|
||||
// bb2: {
|
||||
// ...
|
||||
// _0 = ();
|
||||
// ...
|
||||
// }
|
||||
// END rustc.main.ConstProp.after.mir
|
||||
|
|
52
src/test/mir-opt/const_prop/boxes/rustc.main.ConstProp.diff
Normal file
52
src/test/mir-opt/const_prop/boxes/rustc.main.ConstProp.diff
Normal file
|
@ -0,0 +1,52 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/boxes.rs:11:11: 11:11
|
||||
let _1: i32; // in scope 0 at $DIR/boxes.rs:12:9: 12:10
|
||||
let mut _2: i32; // in scope 0 at $DIR/boxes.rs:12:13: 12:22
|
||||
let mut _3: std::boxed::Box<i32>; // in scope 0 at $DIR/boxes.rs:12:14: 12:22
|
||||
let mut _4: std::boxed::Box<i32>; // in scope 0 at $DIR/boxes.rs:12:14: 12:22
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/boxes.rs:12:9: 12:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/boxes.rs:12:9: 12:10
|
||||
StorageLive(_2); // bb0[1]: scope 0 at $DIR/boxes.rs:12:13: 12:22
|
||||
StorageLive(_3); // bb0[2]: scope 0 at $DIR/boxes.rs:12:14: 12:22
|
||||
StorageLive(_4); // bb0[3]: scope 0 at $DIR/boxes.rs:12:14: 12:22
|
||||
_4 = Box(i32); // bb0[4]: scope 0 at $DIR/boxes.rs:12:14: 12:22
|
||||
(*_4) = const 42i32; // bb0[5]: scope 0 at $DIR/boxes.rs:12:19: 12:21
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x0000002a))
|
||||
// mir::Constant
|
||||
// + span: $DIR/boxes.rs:12:19: 12:21
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x0000002a)) }
|
||||
_3 = move _4; // bb0[6]: scope 0 at $DIR/boxes.rs:12:14: 12:22
|
||||
StorageDead(_4); // bb0[7]: scope 0 at $DIR/boxes.rs:12:21: 12:22
|
||||
_2 = (*_3); // bb0[8]: scope 0 at $DIR/boxes.rs:12:13: 12:22
|
||||
_1 = Add(move _2, const 0i32); // bb0[9]: scope 0 at $DIR/boxes.rs:12:13: 12:26
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000000))
|
||||
// mir::Constant
|
||||
// + span: $DIR/boxes.rs:12:25: 12:26
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000000)) }
|
||||
StorageDead(_2); // bb0[10]: scope 0 at $DIR/boxes.rs:12:25: 12:26
|
||||
drop(_3) -> [return: bb2, unwind: bb1]; // bb0[11]: scope 0 at $DIR/boxes.rs:12:26: 12:27
|
||||
}
|
||||
|
||||
bb1 (cleanup): {
|
||||
resume; // bb1[0]: scope 0 at $DIR/boxes.rs:11:1: 13:2
|
||||
}
|
||||
|
||||
bb2: {
|
||||
StorageDead(_3); // bb2[0]: scope 0 at $DIR/boxes.rs:12:26: 12:27
|
||||
_0 = (); // bb2[1]: scope 0 at $DIR/boxes.rs:11:11: 13:2
|
||||
StorageDead(_1); // bb2[2]: scope 0 at $DIR/boxes.rs:13:1: 13:2
|
||||
return; // bb2[3]: scope 0 at $DIR/boxes.rs:13:2: 13:2
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +1,6 @@
|
|||
// compile-flags: -C overflow-checks=on
|
||||
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
fn main() {
|
||||
let x: u32 = 1 + 1;
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
// START rustc.main.ConstProp.before.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _2 = CheckedAdd(const 1u32, const 1u32);
|
||||
// assert(!move (_2.1: bool), "attempt to add with overflow") -> bb1;
|
||||
// }
|
||||
// END rustc.main.ConstProp.before.mir
|
||||
// START rustc.main.ConstProp.after.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _2 = (const 2u32, const false);
|
||||
// assert(!const false, "attempt to add with overflow") -> bb1;
|
||||
// }
|
||||
// END rustc.main.ConstProp.after.mir
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/checked_add.rs:4:11: 4:11
|
||||
let _1: u32 as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 0 at $DIR/checked_add.rs:5:9: 5:10
|
||||
let mut _2: (u32, bool); // in scope 0 at $DIR/checked_add.rs:5:18: 5:23
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/checked_add.rs:5:9: 5:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/checked_add.rs:5:9: 5:10
|
||||
- _2 = CheckedAdd(const 1u32, const 1u32); // bb0[1]: scope 0 at $DIR/checked_add.rs:5:18: 5:23
|
||||
+ _2 = (const 2u32, const false); // bb0[1]: scope 0 at $DIR/checked_add.rs:5:18: 5:23
|
||||
// ty::Const
|
||||
// + ty: u32
|
||||
- // + val: Value(Scalar(0x00000001))
|
||||
+ // + val: Value(Scalar(0x00000002))
|
||||
// mir::Constant
|
||||
- // + span: $DIR/checked_add.rs:5:18: 5:19
|
||||
- // + literal: Const { ty: u32, val: Value(Scalar(0x00000001)) }
|
||||
+ // + span: $DIR/checked_add.rs:5:18: 5:23
|
||||
+ // + literal: Const { ty: u32, val: Value(Scalar(0x00000002)) }
|
||||
// ty::Const
|
||||
- // + ty: u32
|
||||
- // + val: Value(Scalar(0x00000001))
|
||||
+ // + ty: bool
|
||||
+ // + val: Value(Scalar(0x00))
|
||||
// mir::Constant
|
||||
- // + span: $DIR/checked_add.rs:5:22: 5:23
|
||||
- // + literal: Const { ty: u32, val: Value(Scalar(0x00000001)) }
|
||||
- assert(!move (_2.1: bool), "attempt to add with overflow") -> bb1; // bb0[2]: scope 0 at $DIR/checked_add.rs:5:18: 5:23
|
||||
+ // + span: $DIR/checked_add.rs:5:18: 5:23
|
||||
+ // + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
|
||||
+ assert(!const false, "attempt to add with overflow") -> bb1; // bb0[2]: scope 0 at $DIR/checked_add.rs:5:18: 5:23
|
||||
+ // ty::Const
|
||||
+ // + ty: bool
|
||||
+ // + val: Value(Scalar(0x00))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/checked_add.rs:5:18: 5:23
|
||||
+ // + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
- _1 = move (_2.0: u32); // bb1[0]: scope 0 at $DIR/checked_add.rs:5:18: 5:23
|
||||
+ _1 = const 2u32; // bb1[0]: scope 0 at $DIR/checked_add.rs:5:18: 5:23
|
||||
+ // ty::Const
|
||||
+ // + ty: u32
|
||||
+ // + val: Value(Scalar(0x00000002))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/checked_add.rs:5:18: 5:23
|
||||
+ // + literal: Const { ty: u32, val: Value(Scalar(0x00000002)) }
|
||||
_0 = (); // bb1[1]: scope 0 at $DIR/checked_add.rs:4:11: 6:2
|
||||
StorageDead(_1); // bb1[2]: scope 0 at $DIR/checked_add.rs:6:1: 6:2
|
||||
return; // bb1[3]: scope 0 at $DIR/checked_add.rs:6:2: 6:2
|
||||
}
|
||||
}
|
||||
|
|
@ -1,31 +1,9 @@
|
|||
#[inline(never)]
|
||||
fn read(_: usize) { }
|
||||
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
fn main() {
|
||||
const FOO: &i32 = &1;
|
||||
let x = FOO as *const i32 as usize;
|
||||
read(x);
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
// START rustc.main.ConstProp.before.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _2 = &raw const (*_3);
|
||||
// _1 = move _2 as usize (Misc);
|
||||
// ...
|
||||
// _5 = _1;
|
||||
// _4 = const read(move _5) -> bb1;
|
||||
// }
|
||||
// END rustc.main.ConstProp.before.mir
|
||||
// START rustc.main.ConstProp.after.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _3 = const main::FOO;
|
||||
// _2 = &raw const (*_3);
|
||||
// _1 = move _2 as usize (Misc);
|
||||
// ...
|
||||
// _5 = _1;
|
||||
// _4 = const read(move _5) -> bb1;
|
||||
// }
|
||||
// END rustc.main.ConstProp.after.mir
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/const_prop_fails_gracefully.rs:5:11: 5:11
|
||||
let _1: usize; // in scope 0 at $DIR/const_prop_fails_gracefully.rs:7:9: 7:10
|
||||
let mut _2: *const i32; // in scope 0 at $DIR/const_prop_fails_gracefully.rs:7:13: 7:30
|
||||
let _3: &i32; // in scope 0 at $DIR/const_prop_fails_gracefully.rs:7:13: 7:16
|
||||
let _4: (); // in scope 0 at $DIR/const_prop_fails_gracefully.rs:8:5: 8:12
|
||||
let mut _5: usize; // in scope 0 at $DIR/const_prop_fails_gracefully.rs:8:10: 8:11
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/const_prop_fails_gracefully.rs:7:9: 7:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/const_prop_fails_gracefully.rs:7:9: 7:10
|
||||
StorageLive(_2); // bb0[1]: scope 0 at $DIR/const_prop_fails_gracefully.rs:7:13: 7:30
|
||||
StorageLive(_3); // bb0[2]: scope 0 at $DIR/const_prop_fails_gracefully.rs:7:13: 7:16
|
||||
_3 = const main::FOO; // bb0[3]: scope 0 at $DIR/const_prop_fails_gracefully.rs:7:13: 7:16
|
||||
// ty::Const
|
||||
// + ty: &i32
|
||||
// + val: Unevaluated(DefId(0:5 ~ const_prop_fails_gracefully[317d]::main[0]::FOO[0]), [], None)
|
||||
// mir::Constant
|
||||
// + span: $DIR/const_prop_fails_gracefully.rs:7:13: 7:16
|
||||
// + literal: Const { ty: &i32, val: Unevaluated(DefId(0:5 ~ const_prop_fails_gracefully[317d]::main[0]::FOO[0]), [], None) }
|
||||
_2 = &raw const (*_3); // bb0[4]: scope 0 at $DIR/const_prop_fails_gracefully.rs:7:13: 7:16
|
||||
_1 = move _2 as usize (Misc); // bb0[5]: scope 0 at $DIR/const_prop_fails_gracefully.rs:7:13: 7:39
|
||||
StorageDead(_2); // bb0[6]: scope 0 at $DIR/const_prop_fails_gracefully.rs:7:38: 7:39
|
||||
StorageDead(_3); // bb0[7]: scope 0 at $DIR/const_prop_fails_gracefully.rs:7:39: 7:40
|
||||
StorageLive(_4); // bb0[8]: scope 1 at $DIR/const_prop_fails_gracefully.rs:8:5: 8:12
|
||||
StorageLive(_5); // bb0[9]: scope 1 at $DIR/const_prop_fails_gracefully.rs:8:10: 8:11
|
||||
_5 = _1; // bb0[10]: scope 1 at $DIR/const_prop_fails_gracefully.rs:8:10: 8:11
|
||||
_4 = const read(move _5) -> bb1; // bb0[11]: scope 1 at $DIR/const_prop_fails_gracefully.rs:8:5: 8:12
|
||||
// ty::Const
|
||||
// + ty: fn(usize) {read}
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $DIR/const_prop_fails_gracefully.rs:8:5: 8:9
|
||||
// + literal: Const { ty: fn(usize) {read}, val: Value(Scalar(<ZST>)) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
StorageDead(_5); // bb1[0]: scope 1 at $DIR/const_prop_fails_gracefully.rs:8:11: 8:12
|
||||
StorageDead(_4); // bb1[1]: scope 1 at $DIR/const_prop_fails_gracefully.rs:8:12: 8:13
|
||||
_0 = (); // bb1[2]: scope 0 at $DIR/const_prop_fails_gracefully.rs:5:11: 9:2
|
||||
StorageDead(_1); // bb1[3]: scope 0 at $DIR/const_prop_fails_gracefully.rs:9:1: 9:2
|
||||
return; // bb1[4]: scope 0 at $DIR/const_prop_fails_gracefully.rs:9:2: 9:2
|
||||
}
|
||||
}
|
||||
|
|
@ -6,6 +6,8 @@ trait NeedsDrop:Sized{
|
|||
|
||||
impl<This> NeedsDrop for This{}
|
||||
|
||||
// EMIT_MIR rustc.hello.ConstProp.diff
|
||||
// EMIT_MIR rustc.hello.PreCodegen.before.mir
|
||||
fn hello<T>(){
|
||||
if <bool>::NEEDS {
|
||||
panic!()
|
||||
|
@ -16,49 +18,3 @@ pub fn main() {
|
|||
hello::<()>();
|
||||
hello::<Vec<()>>();
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
// START rustc.hello.ConstProp.before.mir
|
||||
// let mut _0: ();
|
||||
// let mut _1: bool;
|
||||
// let mut _2: !;
|
||||
// bb0: {
|
||||
// StorageLive(_1);
|
||||
// _1 = const <bool as NeedsDrop>::NEEDS;
|
||||
// switchInt(_1) -> [false: bb1, otherwise: bb2];
|
||||
// }
|
||||
// bb1: {
|
||||
// _0 = ();
|
||||
// StorageDead(_1);
|
||||
// return;
|
||||
// }
|
||||
// bb2: {
|
||||
// StorageLive(_2);
|
||||
// const std::rt::begin_panic::<&str>(const "explicit panic");
|
||||
// }
|
||||
// END rustc.hello.ConstProp.before.mir
|
||||
// START rustc.hello.ConstProp.after.mir
|
||||
// let mut _0: ();
|
||||
// let mut _1: bool;
|
||||
// let mut _2: !;
|
||||
// bb0: {
|
||||
// StorageLive(_1);
|
||||
// _1 = const false;
|
||||
// switchInt(const false) -> [false: bb1, otherwise: bb2];
|
||||
// }
|
||||
// bb1: {
|
||||
// _0 = ();
|
||||
// StorageDead(_1);
|
||||
// return;
|
||||
// }
|
||||
// bb2: {
|
||||
// StorageLive(_2);
|
||||
// const std::rt::begin_panic::<&str>(const "explicit panic");
|
||||
// }
|
||||
// END rustc.hello.ConstProp.after.mir
|
||||
// START rustc.hello.PreCodegen.before.mir
|
||||
// let mut _0: ();
|
||||
// bb0: {
|
||||
// return;
|
||||
// }
|
||||
// END rustc.hello.PreCodegen.before.mir
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
- // MIR for `hello` before ConstProp
|
||||
+ // MIR for `hello` after ConstProp
|
||||
|
||||
fn hello() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/control-flow-simplification.rs:11:14: 11:14
|
||||
let mut _1: bool; // in scope 0 at $DIR/control-flow-simplification.rs:12:8: 12:21
|
||||
let mut _2: !; // in scope 0 at $SRC_DIR/libstd/macros.rs:LL:COL
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/control-flow-simplification.rs:12:8: 12:21
|
||||
- _1 = const <bool as NeedsDrop>::NEEDS; // bb0[1]: scope 0 at $DIR/control-flow-simplification.rs:12:8: 12:21
|
||||
+ _1 = const false; // bb0[1]: scope 0 at $DIR/control-flow-simplification.rs:12:8: 12:21
|
||||
// ty::Const
|
||||
// + ty: bool
|
||||
- // + val: Unevaluated(DefId(0:4 ~ control_flow_simplification[317d]::NeedsDrop[0]::NEEDS[0]), [bool], None)
|
||||
+ // + val: Value(Scalar(0x00))
|
||||
// mir::Constant
|
||||
// + span: $DIR/control-flow-simplification.rs:12:8: 12:21
|
||||
- // + literal: Const { ty: bool, val: Unevaluated(DefId(0:4 ~ control_flow_simplification[317d]::NeedsDrop[0]::NEEDS[0]), [bool], None) }
|
||||
- switchInt(_1) -> [false: bb1, otherwise: bb2]; // bb0[2]: scope 0 at $DIR/control-flow-simplification.rs:12:5: 14:6
|
||||
+ // + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
|
||||
+ switchInt(const false) -> [false: bb1, otherwise: bb2]; // bb0[2]: scope 0 at $DIR/control-flow-simplification.rs:12:5: 14:6
|
||||
+ // ty::Const
|
||||
+ // + ty: bool
|
||||
+ // + val: Value(Scalar(0x00))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/control-flow-simplification.rs:12:5: 14:6
|
||||
+ // + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
_0 = (); // bb1[0]: scope 0 at $DIR/control-flow-simplification.rs:12:5: 14:6
|
||||
StorageDead(_1); // bb1[1]: scope 0 at $DIR/control-flow-simplification.rs:15:1: 15:2
|
||||
return; // bb1[2]: scope 0 at $DIR/control-flow-simplification.rs:15:2: 15:2
|
||||
}
|
||||
|
||||
bb2: {
|
||||
StorageLive(_2); // bb2[0]: scope 0 at $SRC_DIR/libstd/macros.rs:LL:COL
|
||||
const std::rt::begin_panic::<&str>(const "explicit panic"); // bb2[1]: scope 0 at $SRC_DIR/libstd/macros.rs:LL:COL
|
||||
// ty::Const
|
||||
// + ty: fn(&str) -> ! {std::rt::begin_panic::<&str>}
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $SRC_DIR/libstd/macros.rs:LL:COL
|
||||
// + literal: Const { ty: fn(&str) -> ! {std::rt::begin_panic::<&str>}, val: Value(Scalar(<ZST>)) }
|
||||
// ty::Const
|
||||
// + ty: &str
|
||||
// + val: Value(Slice { data: Allocation { bytes: [101, 120, 112, 108, 105, 99, 105, 116, 32, 112, 97, 110, 105, 99], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [16383], len: Size { raw: 14 } }, size: Size { raw: 14 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 14 })
|
||||
// mir::Constant
|
||||
// + span: $SRC_DIR/libstd/macros.rs:LL:COL
|
||||
// + literal: Const { ty: &str, val: Value(Slice { data: Allocation { bytes: [101, 120, 112, 108, 105, 99, 105, 116, 32, 112, 97, 110, 105, 99], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [16383], len: Size { raw: 14 } }, size: Size { raw: 14 }, align: Align { pow2: 0 }, mutability: Not, extra: () }, start: 0, end: 14 }) }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
// MIR for `hello` before PreCodegen
|
||||
|
||||
fn hello() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/control-flow-simplification.rs:11:14: 11:14
|
||||
|
||||
bb0: {
|
||||
return; // bb0[0]: scope 0 at $DIR/control-flow-simplification.rs:15:2: 15:2
|
||||
}
|
||||
}
|
|
@ -1,53 +1,7 @@
|
|||
// compile-flags: -O
|
||||
|
||||
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
fn main() {
|
||||
let x = (if let Some(true) = Some(true) { 42 } else { 10 }) + 0;
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
// START rustc.main.ConstProp.before.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _3 = std::option::Option::<bool>::Some(const true,);
|
||||
// _4 = discriminant(_3);
|
||||
// switchInt(move _4) -> [1isize: bb2, otherwise: bb1];
|
||||
// }
|
||||
// bb1: {
|
||||
// _2 = const 10i32;
|
||||
// goto -> bb4;
|
||||
// }
|
||||
// bb2: {
|
||||
// switchInt(((_3 as Some).0: bool)) -> [false: bb1, otherwise: bb3];
|
||||
// }
|
||||
// bb3: {
|
||||
// _2 = const 42i32;
|
||||
// goto -> bb4;
|
||||
// }
|
||||
// bb4: {
|
||||
// _1 = Add(move _2, const 0i32);
|
||||
// ...
|
||||
// }
|
||||
// END rustc.main.ConstProp.before.mir
|
||||
// START rustc.main.ConstProp.after.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _3 = const {transmute(0x01): std::option::Option<bool>};
|
||||
// _4 = const 1isize;
|
||||
// switchInt(const 1isize) -> [1isize: bb2, otherwise: bb1];
|
||||
// }
|
||||
// bb1: {
|
||||
// _2 = const 10i32;
|
||||
// goto -> bb4;
|
||||
// }
|
||||
// bb2: {
|
||||
// switchInt(const true) -> [false: bb1, otherwise: bb3];
|
||||
// }
|
||||
// bb3: {
|
||||
// _2 = const 42i32;
|
||||
// goto -> bb4;
|
||||
// }
|
||||
// bb4: {
|
||||
// _1 = Add(move _2, const 0i32);
|
||||
// ...
|
||||
// }
|
||||
// END rustc.main.ConstProp.after.mir
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/discriminant.rs:5:11: 5:11
|
||||
let _1: i32; // in scope 0 at $DIR/discriminant.rs:6:9: 6:10
|
||||
let mut _2: i32; // in scope 0 at $DIR/discriminant.rs:6:13: 6:64
|
||||
let mut _3: std::option::Option<bool>; // in scope 0 at $DIR/discriminant.rs:6:34: 6:44
|
||||
let mut _4: isize; // in scope 0 at $DIR/discriminant.rs:6:21: 6:31
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/discriminant.rs:6:9: 6:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/discriminant.rs:6:9: 6:10
|
||||
StorageLive(_2); // bb0[1]: scope 0 at $DIR/discriminant.rs:6:13: 6:64
|
||||
StorageLive(_3); // bb0[2]: scope 0 at $DIR/discriminant.rs:6:34: 6:44
|
||||
- _3 = std::option::Option::<bool>::Some(const true,); // bb0[3]: scope 0 at $DIR/discriminant.rs:6:34: 6:44
|
||||
+ _3 = const {transmute(0x01): std::option::Option<bool>}; // bb0[3]: scope 0 at $DIR/discriminant.rs:6:34: 6:44
|
||||
// ty::Const
|
||||
- // + ty: bool
|
||||
+ // + ty: std::option::Option<bool>
|
||||
// + val: Value(Scalar(0x01))
|
||||
// mir::Constant
|
||||
- // + span: $DIR/discriminant.rs:6:39: 6:43
|
||||
- // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
|
||||
- _4 = discriminant(_3); // bb0[4]: scope 0 at $DIR/discriminant.rs:6:21: 6:31
|
||||
- switchInt(move _4) -> [1isize: bb2, otherwise: bb1]; // bb0[5]: scope 0 at $DIR/discriminant.rs:6:21: 6:31
|
||||
+ // + span: $DIR/discriminant.rs:6:34: 6:44
|
||||
+ // + literal: Const { ty: std::option::Option<bool>, val: Value(Scalar(0x01)) }
|
||||
+ _4 = const 1isize; // bb0[4]: scope 0 at $DIR/discriminant.rs:6:21: 6:31
|
||||
+ // ty::Const
|
||||
+ // + ty: isize
|
||||
+ // + val: Value(Scalar(0x00000001))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/discriminant.rs:6:21: 6:31
|
||||
+ // + literal: Const { ty: isize, val: Value(Scalar(0x00000001)) }
|
||||
+ switchInt(const 1isize) -> [1isize: bb2, otherwise: bb1]; // bb0[5]: scope 0 at $DIR/discriminant.rs:6:21: 6:31
|
||||
+ // ty::Const
|
||||
+ // + ty: isize
|
||||
+ // + val: Value(Scalar(0x00000001))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/discriminant.rs:6:21: 6:31
|
||||
+ // + literal: Const { ty: isize, val: Value(Scalar(0x00000001)) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
_2 = const 10i32; // bb1[0]: scope 0 at $DIR/discriminant.rs:6:59: 6:61
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x0000000a))
|
||||
// mir::Constant
|
||||
// + span: $DIR/discriminant.rs:6:59: 6:61
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x0000000a)) }
|
||||
goto -> bb4; // bb1[1]: scope 0 at $DIR/discriminant.rs:6:13: 6:64
|
||||
}
|
||||
|
||||
bb2: {
|
||||
- switchInt(((_3 as Some).0: bool)) -> [false: bb1, otherwise: bb3]; // bb2[0]: scope 0 at $DIR/discriminant.rs:6:26: 6:30
|
||||
+ switchInt(const true) -> [false: bb1, otherwise: bb3]; // bb2[0]: scope 0 at $DIR/discriminant.rs:6:26: 6:30
|
||||
+ // ty::Const
|
||||
+ // + ty: bool
|
||||
+ // + val: Value(Scalar(0x01))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/discriminant.rs:6:26: 6:30
|
||||
+ // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
|
||||
}
|
||||
|
||||
bb3: {
|
||||
_2 = const 42i32; // bb3[0]: scope 0 at $DIR/discriminant.rs:6:47: 6:49
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x0000002a))
|
||||
// mir::Constant
|
||||
// + span: $DIR/discriminant.rs:6:47: 6:49
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x0000002a)) }
|
||||
goto -> bb4; // bb3[1]: scope 0 at $DIR/discriminant.rs:6:13: 6:64
|
||||
}
|
||||
|
||||
bb4: {
|
||||
_1 = Add(move _2, const 0i32); // bb4[0]: scope 0 at $DIR/discriminant.rs:6:13: 6:68
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000000))
|
||||
// mir::Constant
|
||||
// + span: $DIR/discriminant.rs:6:67: 6:68
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000000)) }
|
||||
StorageDead(_2); // bb4[1]: scope 0 at $DIR/discriminant.rs:6:67: 6:68
|
||||
StorageDead(_3); // bb4[2]: scope 0 at $DIR/discriminant.rs:6:68: 6:69
|
||||
_0 = (); // bb4[3]: scope 0 at $DIR/discriminant.rs:5:11: 7:2
|
||||
StorageDead(_1); // bb4[4]: scope 0 at $DIR/discriminant.rs:7:1: 7:2
|
||||
return; // bb4[5]: scope 0 at $DIR/discriminant.rs:7:2: 7:2
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/discriminant.rs:5:11: 5:11
|
||||
let _1: i32; // in scope 0 at $DIR/discriminant.rs:6:9: 6:10
|
||||
let mut _2: i32; // in scope 0 at $DIR/discriminant.rs:6:13: 6:64
|
||||
let mut _3: std::option::Option<bool>; // in scope 0 at $DIR/discriminant.rs:6:34: 6:44
|
||||
let mut _4: isize; // in scope 0 at $DIR/discriminant.rs:6:21: 6:31
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/discriminant.rs:6:9: 6:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/discriminant.rs:6:9: 6:10
|
||||
StorageLive(_2); // bb0[1]: scope 0 at $DIR/discriminant.rs:6:13: 6:64
|
||||
StorageLive(_3); // bb0[2]: scope 0 at $DIR/discriminant.rs:6:34: 6:44
|
||||
- _3 = std::option::Option::<bool>::Some(const true,); // bb0[3]: scope 0 at $DIR/discriminant.rs:6:34: 6:44
|
||||
+ _3 = const {transmute(0x01): std::option::Option<bool>}; // bb0[3]: scope 0 at $DIR/discriminant.rs:6:34: 6:44
|
||||
// ty::Const
|
||||
- // + ty: bool
|
||||
+ // + ty: std::option::Option<bool>
|
||||
// + val: Value(Scalar(0x01))
|
||||
// mir::Constant
|
||||
- // + span: $DIR/discriminant.rs:6:39: 6:43
|
||||
- // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
|
||||
- _4 = discriminant(_3); // bb0[4]: scope 0 at $DIR/discriminant.rs:6:21: 6:31
|
||||
- switchInt(move _4) -> [1isize: bb2, otherwise: bb1]; // bb0[5]: scope 0 at $DIR/discriminant.rs:6:21: 6:31
|
||||
+ // + span: $DIR/discriminant.rs:6:34: 6:44
|
||||
+ // + literal: Const { ty: std::option::Option<bool>, val: Value(Scalar(0x01)) }
|
||||
+ _4 = const 1isize; // bb0[4]: scope 0 at $DIR/discriminant.rs:6:21: 6:31
|
||||
+ // ty::Const
|
||||
+ // + ty: isize
|
||||
+ // + val: Value(Scalar(0x0000000000000001))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/discriminant.rs:6:21: 6:31
|
||||
+ // + literal: Const { ty: isize, val: Value(Scalar(0x0000000000000001)) }
|
||||
+ switchInt(const 1isize) -> [1isize: bb2, otherwise: bb1]; // bb0[5]: scope 0 at $DIR/discriminant.rs:6:21: 6:31
|
||||
+ // ty::Const
|
||||
+ // + ty: isize
|
||||
+ // + val: Value(Scalar(0x0000000000000001))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/discriminant.rs:6:21: 6:31
|
||||
+ // + literal: Const { ty: isize, val: Value(Scalar(0x0000000000000001)) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
_2 = const 10i32; // bb1[0]: scope 0 at $DIR/discriminant.rs:6:59: 6:61
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x0000000a))
|
||||
// mir::Constant
|
||||
// + span: $DIR/discriminant.rs:6:59: 6:61
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x0000000a)) }
|
||||
goto -> bb4; // bb1[1]: scope 0 at $DIR/discriminant.rs:6:13: 6:64
|
||||
}
|
||||
|
||||
bb2: {
|
||||
- switchInt(((_3 as Some).0: bool)) -> [false: bb1, otherwise: bb3]; // bb2[0]: scope 0 at $DIR/discriminant.rs:6:26: 6:30
|
||||
+ switchInt(const true) -> [false: bb1, otherwise: bb3]; // bb2[0]: scope 0 at $DIR/discriminant.rs:6:26: 6:30
|
||||
+ // ty::Const
|
||||
+ // + ty: bool
|
||||
+ // + val: Value(Scalar(0x01))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/discriminant.rs:6:26: 6:30
|
||||
+ // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
|
||||
}
|
||||
|
||||
bb3: {
|
||||
_2 = const 42i32; // bb3[0]: scope 0 at $DIR/discriminant.rs:6:47: 6:49
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x0000002a))
|
||||
// mir::Constant
|
||||
// + span: $DIR/discriminant.rs:6:47: 6:49
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x0000002a)) }
|
||||
goto -> bb4; // bb3[1]: scope 0 at $DIR/discriminant.rs:6:13: 6:64
|
||||
}
|
||||
|
||||
bb4: {
|
||||
_1 = Add(move _2, const 0i32); // bb4[0]: scope 0 at $DIR/discriminant.rs:6:13: 6:68
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000000))
|
||||
// mir::Constant
|
||||
// + span: $DIR/discriminant.rs:6:67: 6:68
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000000)) }
|
||||
StorageDead(_2); // bb4[1]: scope 0 at $DIR/discriminant.rs:6:67: 6:68
|
||||
StorageDead(_3); // bb4[2]: scope 0 at $DIR/discriminant.rs:6:68: 6:69
|
||||
_0 = (); // bb4[3]: scope 0 at $DIR/discriminant.rs:5:11: 7:2
|
||||
StorageDead(_1); // bb4[4]: scope 0 at $DIR/discriminant.rs:7:1: 7:2
|
||||
return; // bb4[5]: scope 0 at $DIR/discriminant.rs:7:2: 7:2
|
||||
}
|
||||
}
|
||||
|
|
@ -1,23 +1,6 @@
|
|||
// compile-flags: -C overflow-checks=on
|
||||
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
fn main() {
|
||||
let x = (2u32 as u8) + 1;
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
// START rustc.main.ConstProp.before.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _2 = const 2u32 as u8 (Misc);
|
||||
// _3 = CheckedAdd(move _2, const 1u8);
|
||||
// assert(!move (_3.1: bool), "attempt to add with overflow") -> bb1;
|
||||
//}
|
||||
// END rustc.main.ConstProp.before.mir
|
||||
// START rustc.main.ConstProp.after.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _2 = const 2u8;
|
||||
// _3 = (const 3u8, const false);
|
||||
// assert(!const false, "attempt to add with overflow") -> bb1;
|
||||
// }
|
||||
// END rustc.main.ConstProp.after.mir
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/indirect.rs:4:11: 4:11
|
||||
let _1: u8; // in scope 0 at $DIR/indirect.rs:5:9: 5:10
|
||||
let mut _2: u8; // in scope 0 at $DIR/indirect.rs:5:13: 5:25
|
||||
let mut _3: (u8, bool); // in scope 0 at $DIR/indirect.rs:5:13: 5:29
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/indirect.rs:5:9: 5:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/indirect.rs:5:9: 5:10
|
||||
StorageLive(_2); // bb0[1]: scope 0 at $DIR/indirect.rs:5:13: 5:25
|
||||
- _2 = const 2u32 as u8 (Misc); // bb0[2]: scope 0 at $DIR/indirect.rs:5:13: 5:25
|
||||
+ _2 = const 2u8; // bb0[2]: scope 0 at $DIR/indirect.rs:5:13: 5:25
|
||||
// ty::Const
|
||||
- // + ty: u32
|
||||
- // + val: Value(Scalar(0x00000002))
|
||||
+ // + ty: u8
|
||||
+ // + val: Value(Scalar(0x02))
|
||||
// mir::Constant
|
||||
- // + span: $DIR/indirect.rs:5:14: 5:18
|
||||
- // + literal: Const { ty: u32, val: Value(Scalar(0x00000002)) }
|
||||
- _3 = CheckedAdd(move _2, const 1u8); // bb0[3]: scope 0 at $DIR/indirect.rs:5:13: 5:29
|
||||
+ // + span: $DIR/indirect.rs:5:13: 5:25
|
||||
+ // + literal: Const { ty: u8, val: Value(Scalar(0x02)) }
|
||||
+ _3 = (const 3u8, const false); // bb0[3]: scope 0 at $DIR/indirect.rs:5:13: 5:29
|
||||
// ty::Const
|
||||
// + ty: u8
|
||||
- // + val: Value(Scalar(0x01))
|
||||
+ // + val: Value(Scalar(0x03))
|
||||
// mir::Constant
|
||||
- // + span: $DIR/indirect.rs:5:28: 5:29
|
||||
- // + literal: Const { ty: u8, val: Value(Scalar(0x01)) }
|
||||
- assert(!move (_3.1: bool), "attempt to add with overflow") -> bb1; // bb0[4]: scope 0 at $DIR/indirect.rs:5:13: 5:29
|
||||
+ // + span: $DIR/indirect.rs:5:13: 5:29
|
||||
+ // + literal: Const { ty: u8, val: Value(Scalar(0x03)) }
|
||||
+ // ty::Const
|
||||
+ // + ty: bool
|
||||
+ // + val: Value(Scalar(0x00))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/indirect.rs:5:13: 5:29
|
||||
+ // + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
|
||||
+ assert(!const false, "attempt to add with overflow") -> bb1; // bb0[4]: scope 0 at $DIR/indirect.rs:5:13: 5:29
|
||||
+ // ty::Const
|
||||
+ // + ty: bool
|
||||
+ // + val: Value(Scalar(0x00))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/indirect.rs:5:13: 5:29
|
||||
+ // + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
- _1 = move (_3.0: u8); // bb1[0]: scope 0 at $DIR/indirect.rs:5:13: 5:29
|
||||
+ _1 = const 3u8; // bb1[0]: scope 0 at $DIR/indirect.rs:5:13: 5:29
|
||||
+ // ty::Const
|
||||
+ // + ty: u8
|
||||
+ // + val: Value(Scalar(0x03))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/indirect.rs:5:13: 5:29
|
||||
+ // + literal: Const { ty: u8, val: Value(Scalar(0x03)) }
|
||||
StorageDead(_2); // bb1[1]: scope 0 at $DIR/indirect.rs:5:28: 5:29
|
||||
_0 = (); // bb1[2]: scope 0 at $DIR/indirect.rs:4:11: 6:2
|
||||
StorageDead(_1); // bb1[3]: scope 0 at $DIR/indirect.rs:6:1: 6:2
|
||||
return; // bb1[4]: scope 0 at $DIR/indirect.rs:6:2: 6:2
|
||||
}
|
||||
}
|
||||
|
|
@ -11,28 +11,7 @@ fn encode(this: ((), u8, u8)) {
|
|||
assert!(this.2 == 0);
|
||||
}
|
||||
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
fn main() {
|
||||
encode(((), 0, 0));
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
// START rustc.main.ConstProp.before.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _3 = ();
|
||||
// _2 = (move _3, const 0u8, const 0u8);
|
||||
// ...
|
||||
// _1 = const encode(move _2) -> bb1;
|
||||
// ...
|
||||
// }
|
||||
// END rustc.main.ConstProp.before.mir
|
||||
// START rustc.main.ConstProp.after.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _3 = const ();
|
||||
// _2 = (move _3, const 0u8, const 0u8);
|
||||
// ...
|
||||
// _1 = const encode(move _2) -> bb1;
|
||||
// ...
|
||||
// }
|
||||
// END rustc.main.ConstProp.after.mir
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/issue-66971.rs:15:11: 15:11
|
||||
let _1: (); // in scope 0 at $DIR/issue-66971.rs:16:5: 16:23
|
||||
let mut _2: ((), u8, u8); // in scope 0 at $DIR/issue-66971.rs:16:12: 16:22
|
||||
let mut _3: (); // in scope 0 at $DIR/issue-66971.rs:16:13: 16:15
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/issue-66971.rs:16:5: 16:23
|
||||
StorageLive(_2); // bb0[1]: scope 0 at $DIR/issue-66971.rs:16:12: 16:22
|
||||
StorageLive(_3); // bb0[2]: scope 0 at $DIR/issue-66971.rs:16:13: 16:15
|
||||
- _3 = (); // bb0[3]: scope 0 at $DIR/issue-66971.rs:16:13: 16:15
|
||||
+ _3 = const (); // bb0[3]: scope 0 at $DIR/issue-66971.rs:16:13: 16:15
|
||||
+ // ty::Const
|
||||
+ // + ty: ()
|
||||
+ // + val: Value(Scalar(<ZST>))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/issue-66971.rs:16:13: 16:15
|
||||
+ // + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
|
||||
_2 = (move _3, const 0u8, const 0u8); // bb0[4]: scope 0 at $DIR/issue-66971.rs:16:12: 16:22
|
||||
// ty::Const
|
||||
// + ty: u8
|
||||
// + val: Value(Scalar(0x00))
|
||||
// mir::Constant
|
||||
// + span: $DIR/issue-66971.rs:16:17: 16:18
|
||||
// + literal: Const { ty: u8, val: Value(Scalar(0x00)) }
|
||||
// ty::Const
|
||||
// + ty: u8
|
||||
// + val: Value(Scalar(0x00))
|
||||
// mir::Constant
|
||||
// + span: $DIR/issue-66971.rs:16:20: 16:21
|
||||
// + literal: Const { ty: u8, val: Value(Scalar(0x00)) }
|
||||
StorageDead(_3); // bb0[5]: scope 0 at $DIR/issue-66971.rs:16:21: 16:22
|
||||
_1 = const encode(move _2) -> bb1; // bb0[6]: scope 0 at $DIR/issue-66971.rs:16:5: 16:23
|
||||
// ty::Const
|
||||
// + ty: fn(((), u8, u8)) {encode}
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $DIR/issue-66971.rs:16:5: 16:11
|
||||
// + literal: Const { ty: fn(((), u8, u8)) {encode}, val: Value(Scalar(<ZST>)) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
StorageDead(_2); // bb1[0]: scope 0 at $DIR/issue-66971.rs:16:22: 16:23
|
||||
StorageDead(_1); // bb1[1]: scope 0 at $DIR/issue-66971.rs:16:23: 16:24
|
||||
_0 = (); // bb1[2]: scope 0 at $DIR/issue-66971.rs:15:11: 17:2
|
||||
return; // bb1[3]: scope 0 at $DIR/issue-66971.rs:17:2: 17:2
|
||||
}
|
||||
}
|
||||
|
|
@ -6,29 +6,7 @@ fn test(this: ((u8, u8),)) {
|
|||
assert!((this.0).0 == 1);
|
||||
}
|
||||
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
fn main() {
|
||||
test(((1, 2),));
|
||||
}
|
||||
|
||||
// Important bit is parameter passing so we only check that below
|
||||
// END RUST SOURCE
|
||||
// START rustc.main.ConstProp.before.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _3 = (const 1u8, const 2u8);
|
||||
// _2 = (move _3,);
|
||||
// ...
|
||||
// _1 = const test(move _2) -> bb1;
|
||||
// ...
|
||||
// }
|
||||
// END rustc.main.ConstProp.before.mir
|
||||
// START rustc.main.ConstProp.after.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _3 = (const 1u8, const 2u8);
|
||||
// _2 = (move _3,);
|
||||
// ...
|
||||
// _1 = const test(move _2) -> bb1;
|
||||
// ...
|
||||
// }
|
||||
// END rustc.main.ConstProp.after.mir
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/issue-67019.rs:10:11: 10:11
|
||||
let _1: (); // in scope 0 at $DIR/issue-67019.rs:11:5: 11:20
|
||||
let mut _2: ((u8, u8),); // in scope 0 at $DIR/issue-67019.rs:11:10: 11:19
|
||||
let mut _3: (u8, u8); // in scope 0 at $DIR/issue-67019.rs:11:11: 11:17
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/issue-67019.rs:11:5: 11:20
|
||||
StorageLive(_2); // bb0[1]: scope 0 at $DIR/issue-67019.rs:11:10: 11:19
|
||||
StorageLive(_3); // bb0[2]: scope 0 at $DIR/issue-67019.rs:11:11: 11:17
|
||||
_3 = (const 1u8, const 2u8); // bb0[3]: scope 0 at $DIR/issue-67019.rs:11:11: 11:17
|
||||
// ty::Const
|
||||
// + ty: u8
|
||||
// + val: Value(Scalar(0x01))
|
||||
// mir::Constant
|
||||
- // + span: $DIR/issue-67019.rs:11:12: 11:13
|
||||
+ // + span: $DIR/issue-67019.rs:11:11: 11:17
|
||||
// + literal: Const { ty: u8, val: Value(Scalar(0x01)) }
|
||||
// ty::Const
|
||||
// + ty: u8
|
||||
// + val: Value(Scalar(0x02))
|
||||
// mir::Constant
|
||||
- // + span: $DIR/issue-67019.rs:11:15: 11:16
|
||||
+ // + span: $DIR/issue-67019.rs:11:11: 11:17
|
||||
// + literal: Const { ty: u8, val: Value(Scalar(0x02)) }
|
||||
_2 = (move _3,); // bb0[4]: scope 0 at $DIR/issue-67019.rs:11:10: 11:19
|
||||
StorageDead(_3); // bb0[5]: scope 0 at $DIR/issue-67019.rs:11:18: 11:19
|
||||
_1 = const test(move _2) -> bb1; // bb0[6]: scope 0 at $DIR/issue-67019.rs:11:5: 11:20
|
||||
// ty::Const
|
||||
// + ty: fn(((u8, u8),)) {test}
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $DIR/issue-67019.rs:11:5: 11:9
|
||||
// + literal: Const { ty: fn(((u8, u8),)) {test}, val: Value(Scalar(<ZST>)) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
StorageDead(_2); // bb1[0]: scope 0 at $DIR/issue-67019.rs:11:19: 11:20
|
||||
StorageDead(_1); // bb1[1]: scope 0 at $DIR/issue-67019.rs:11:20: 11:21
|
||||
_0 = (); // bb1[2]: scope 0 at $DIR/issue-67019.rs:10:11: 12:2
|
||||
return; // bb1[3]: scope 0 at $DIR/issue-67019.rs:12:2: 12:2
|
||||
}
|
||||
}
|
||||
|
|
@ -5,145 +5,11 @@ struct Point {
|
|||
y: u32,
|
||||
}
|
||||
|
||||
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
// EMIT_MIR rustc.main.SimplifyLocals.after.mir
|
||||
fn main() {
|
||||
let x = 2 + 2;
|
||||
let y = [0, 1, 2, 3, 4, 5][3];
|
||||
let z = (Point { x: 12, y: 42}).y;
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
// START rustc.main.ConstProp.before.mir
|
||||
// let mut _0: ();
|
||||
// let _1: i32;
|
||||
// let mut _2: (i32, bool);
|
||||
// let mut _4: [i32; 6];
|
||||
// let _5: usize;
|
||||
// let mut _6: usize;
|
||||
// let mut _7: bool;
|
||||
// let mut _9: Point;
|
||||
// scope 1 {
|
||||
// debug x => _1;
|
||||
// let _3: i32;
|
||||
// scope 2 {
|
||||
// debug y => _3;
|
||||
// let _8: u32;
|
||||
// scope 3 {
|
||||
// debug z => _8;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// bb0: {
|
||||
// StorageLive(_1);
|
||||
// _2 = CheckedAdd(const 2i32, const 2i32);
|
||||
// assert(!move (_2.1: bool), "attempt to add with overflow") -> bb1;
|
||||
// }
|
||||
// bb1: {
|
||||
// _1 = move (_2.0: i32);
|
||||
// StorageLive(_3);
|
||||
// StorageLive(_4);
|
||||
// _4 = [const 0i32, const 1i32, const 2i32, const 3i32, const 4i32, const 5i32];
|
||||
// StorageLive(_5);
|
||||
// _5 = const 3usize;
|
||||
// _6 = const 6usize;
|
||||
// _7 = Lt(_5, _6);
|
||||
// assert(move _7, "index out of bounds: the len is move _6 but the index is _5") -> bb2;
|
||||
// }
|
||||
// bb2: {
|
||||
// _3 = _4[_5];
|
||||
// StorageDead(_5);
|
||||
// StorageDead(_4);
|
||||
// StorageLive(_8);
|
||||
// StorageLive(_9);
|
||||
// _9 = Point { x: const 12u32, y: const 42u32 };
|
||||
// _8 = (_9.1: u32);
|
||||
// StorageDead(_9);
|
||||
// _0 = ();
|
||||
// StorageDead(_8);
|
||||
// StorageDead(_3);
|
||||
// StorageDead(_1);
|
||||
// return;
|
||||
// }
|
||||
// END rustc.main.ConstProp.before.mir
|
||||
// START rustc.main.ConstProp.after.mir
|
||||
// let mut _0: ();
|
||||
// let _1: i32;
|
||||
// let mut _2: (i32, bool);
|
||||
// let mut _4: [i32; 6];
|
||||
// let _5: usize;
|
||||
// let mut _6: usize;
|
||||
// let mut _7: bool;
|
||||
// let mut _9: Point;
|
||||
// scope 1 {
|
||||
// debug x => _1;
|
||||
// let _3: i32;
|
||||
// scope 2 {
|
||||
// debug y => _3;
|
||||
// let _8: u32;
|
||||
// scope 3 {
|
||||
// debug z => _8;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// bb0: {
|
||||
// StorageLive(_1);
|
||||
// _2 = (const 4i32, const false);
|
||||
// assert(!const false, "attempt to add with overflow") -> bb1;
|
||||
// }
|
||||
// bb1: {
|
||||
// _1 = const 4i32;
|
||||
// StorageLive(_3);
|
||||
// StorageLive(_4);
|
||||
// _4 = [const 0i32, const 1i32, const 2i32, const 3i32, const 4i32, const 5i32];
|
||||
// StorageLive(_5);
|
||||
// _5 = const 3usize;
|
||||
// _6 = const 6usize;
|
||||
// _7 = const true;
|
||||
// assert(const true, "index out of bounds: the len is move _6 but the index is _5") -> bb2;
|
||||
// }
|
||||
// bb2: {
|
||||
// _3 = const 3i32;
|
||||
// StorageDead(_5);
|
||||
// StorageDead(_4);
|
||||
// StorageLive(_8);
|
||||
// StorageLive(_9);
|
||||
// _9 = Point { x: const 12u32, y: const 42u32 };
|
||||
// _8 = const 42u32;
|
||||
// StorageDead(_9);
|
||||
// _0 = ();
|
||||
// StorageDead(_8);
|
||||
// StorageDead(_3);
|
||||
// StorageDead(_1);
|
||||
// return;
|
||||
// }
|
||||
// END rustc.main.ConstProp.after.mir
|
||||
// START rustc.main.SimplifyLocals.after.mir
|
||||
// let mut _0: ();
|
||||
// let _1: i32;
|
||||
// let mut _3: [i32; 6];
|
||||
// scope 1 {
|
||||
// debug x => _1;
|
||||
// let _2: i32;
|
||||
// scope 2 {
|
||||
// debug y => _2;
|
||||
// let _4: u32;
|
||||
// scope 3 {
|
||||
// debug z => _4;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// bb0: {
|
||||
// StorageLive(_1);
|
||||
// _1 = const 4i32;
|
||||
// StorageLive(_2);
|
||||
// StorageLive(_3);
|
||||
// _3 = [const 0i32, const 1i32, const 2i32, const 3i32, const 4i32, const 5i32];
|
||||
// _2 = const 3i32;
|
||||
// StorageDead(_3);
|
||||
// StorageLive(_4);
|
||||
// _4 = const 42u32;
|
||||
// StorageDead(_4);
|
||||
// StorageDead(_2);
|
||||
// StorageDead(_1);
|
||||
// return;
|
||||
// }
|
||||
// END rustc.main.SimplifyLocals.after.mir
|
||||
|
|
|
@ -0,0 +1,181 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:11:11: 11:11
|
||||
let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:12:9: 12:10
|
||||
let mut _2: (i32, bool); // in scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
|
||||
let mut _4: [i32; 6]; // in scope 0 at $DIR/optimizes_into_variable.rs:13:13: 13:31
|
||||
let _5: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:13:32: 13:33
|
||||
let mut _6: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:13:13: 13:34
|
||||
let mut _7: bool; // in scope 0 at $DIR/optimizes_into_variable.rs:13:13: 13:34
|
||||
let mut _9: Point; // in scope 0 at $DIR/optimizes_into_variable.rs:14:13: 14:36
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:12:9: 12:10
|
||||
let _3: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:13:9: 13:10
|
||||
scope 2 {
|
||||
debug y => _3; // in scope 2 at $DIR/optimizes_into_variable.rs:13:9: 13:10
|
||||
let _8: u32; // in scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10
|
||||
scope 3 {
|
||||
debug z => _8; // in scope 3 at $DIR/optimizes_into_variable.rs:14:9: 14:10
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/optimizes_into_variable.rs:12:9: 12:10
|
||||
- _2 = CheckedAdd(const 2i32, const 2i32); // bb0[1]: scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
|
||||
+ _2 = (const 4i32, const false); // bb0[1]: scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
- // + val: Value(Scalar(0x00000002))
|
||||
+ // + val: Value(Scalar(0x00000004))
|
||||
// mir::Constant
|
||||
- // + span: $DIR/optimizes_into_variable.rs:12:13: 12:14
|
||||
- // + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) }
|
||||
+ // + span: $DIR/optimizes_into_variable.rs:12:13: 12:18
|
||||
+ // + literal: Const { ty: i32, val: Value(Scalar(0x00000004)) }
|
||||
// ty::Const
|
||||
- // + ty: i32
|
||||
- // + val: Value(Scalar(0x00000002))
|
||||
+ // + ty: bool
|
||||
+ // + val: Value(Scalar(0x00))
|
||||
// mir::Constant
|
||||
- // + span: $DIR/optimizes_into_variable.rs:12:17: 12:18
|
||||
- // + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) }
|
||||
- assert(!move (_2.1: bool), "attempt to add with overflow") -> bb1; // bb0[2]: scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
|
||||
+ // + span: $DIR/optimizes_into_variable.rs:12:13: 12:18
|
||||
+ // + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
|
||||
+ assert(!const false, "attempt to add with overflow") -> bb1; // bb0[2]: scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
|
||||
+ // ty::Const
|
||||
+ // + ty: bool
|
||||
+ // + val: Value(Scalar(0x00))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/optimizes_into_variable.rs:12:13: 12:18
|
||||
+ // + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
- _1 = move (_2.0: i32); // bb1[0]: scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
|
||||
+ _1 = const 4i32; // bb1[0]: scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
|
||||
+ // ty::Const
|
||||
+ // + ty: i32
|
||||
+ // + val: Value(Scalar(0x00000004))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/optimizes_into_variable.rs:12:13: 12:18
|
||||
+ // + literal: Const { ty: i32, val: Value(Scalar(0x00000004)) }
|
||||
StorageLive(_3); // bb1[1]: scope 1 at $DIR/optimizes_into_variable.rs:13:9: 13:10
|
||||
StorageLive(_4); // bb1[2]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:31
|
||||
_4 = [const 0i32, const 1i32, const 2i32, const 3i32, const 4i32, const 5i32]; // bb1[3]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:31
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000000))
|
||||
// mir::Constant
|
||||
// + span: $DIR/optimizes_into_variable.rs:13:14: 13:15
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000000)) }
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000001))
|
||||
// mir::Constant
|
||||
// + span: $DIR/optimizes_into_variable.rs:13:17: 13:18
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) }
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000002))
|
||||
// mir::Constant
|
||||
// + span: $DIR/optimizes_into_variable.rs:13:20: 13:21
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) }
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000003))
|
||||
// mir::Constant
|
||||
// + span: $DIR/optimizes_into_variable.rs:13:23: 13:24
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000003)) }
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000004))
|
||||
// mir::Constant
|
||||
// + span: $DIR/optimizes_into_variable.rs:13:26: 13:27
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000004)) }
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000005))
|
||||
// mir::Constant
|
||||
// + span: $DIR/optimizes_into_variable.rs:13:29: 13:30
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000005)) }
|
||||
StorageLive(_5); // bb1[4]: scope 1 at $DIR/optimizes_into_variable.rs:13:32: 13:33
|
||||
_5 = const 3usize; // bb1[5]: scope 1 at $DIR/optimizes_into_variable.rs:13:32: 13:33
|
||||
// ty::Const
|
||||
// + ty: usize
|
||||
// + val: Value(Scalar(0x00000003))
|
||||
// mir::Constant
|
||||
// + span: $DIR/optimizes_into_variable.rs:13:32: 13:33
|
||||
// + literal: Const { ty: usize, val: Value(Scalar(0x00000003)) }
|
||||
_6 = const 6usize; // bb1[6]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
|
||||
// ty::Const
|
||||
// + ty: usize
|
||||
// + val: Value(Scalar(0x00000006))
|
||||
// mir::Constant
|
||||
// + span: $DIR/optimizes_into_variable.rs:13:13: 13:34
|
||||
// + literal: Const { ty: usize, val: Value(Scalar(0x00000006)) }
|
||||
- _7 = Lt(_5, _6); // bb1[7]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
|
||||
- assert(move _7, "index out of bounds: the len is move _6 but the index is _5") -> bb2; // bb1[8]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
|
||||
+ _7 = const true; // bb1[7]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
|
||||
+ // ty::Const
|
||||
+ // + ty: bool
|
||||
+ // + val: Value(Scalar(0x01))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/optimizes_into_variable.rs:13:13: 13:34
|
||||
+ // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
|
||||
+ assert(const true, "index out of bounds: the len is move _6 but the index is _5") -> bb2; // bb1[8]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
|
||||
+ // ty::Const
|
||||
+ // + ty: bool
|
||||
+ // + val: Value(Scalar(0x01))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/optimizes_into_variable.rs:13:13: 13:34
|
||||
+ // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
|
||||
}
|
||||
|
||||
bb2: {
|
||||
- _3 = _4[_5]; // bb2[0]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
|
||||
+ _3 = const 3i32; // bb2[0]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
|
||||
+ // ty::Const
|
||||
+ // + ty: i32
|
||||
+ // + val: Value(Scalar(0x00000003))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/optimizes_into_variable.rs:13:13: 13:34
|
||||
+ // + literal: Const { ty: i32, val: Value(Scalar(0x00000003)) }
|
||||
StorageDead(_5); // bb2[1]: scope 1 at $DIR/optimizes_into_variable.rs:13:34: 13:35
|
||||
StorageDead(_4); // bb2[2]: scope 1 at $DIR/optimizes_into_variable.rs:13:34: 13:35
|
||||
StorageLive(_8); // bb2[3]: scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10
|
||||
StorageLive(_9); // bb2[4]: scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:36
|
||||
_9 = Point { x: const 12u32, y: const 42u32 }; // bb2[5]: scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:36
|
||||
// ty::Const
|
||||
// + ty: u32
|
||||
// + val: Value(Scalar(0x0000000c))
|
||||
// mir::Constant
|
||||
// + span: $DIR/optimizes_into_variable.rs:14:25: 14:27
|
||||
// + literal: Const { ty: u32, val: Value(Scalar(0x0000000c)) }
|
||||
// ty::Const
|
||||
// + ty: u32
|
||||
// + val: Value(Scalar(0x0000002a))
|
||||
// mir::Constant
|
||||
// + span: $DIR/optimizes_into_variable.rs:14:32: 14:34
|
||||
// + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) }
|
||||
- _8 = (_9.1: u32); // bb2[6]: scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:38
|
||||
+ _8 = const 42u32; // bb2[6]: scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:38
|
||||
+ // ty::Const
|
||||
+ // + ty: u32
|
||||
+ // + val: Value(Scalar(0x0000002a))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/optimizes_into_variable.rs:14:13: 14:38
|
||||
+ // + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) }
|
||||
StorageDead(_9); // bb2[7]: scope 2 at $DIR/optimizes_into_variable.rs:14:38: 14:39
|
||||
_0 = (); // bb2[8]: scope 0 at $DIR/optimizes_into_variable.rs:11:11: 15:2
|
||||
StorageDead(_8); // bb2[9]: scope 2 at $DIR/optimizes_into_variable.rs:15:1: 15:2
|
||||
StorageDead(_3); // bb2[10]: scope 1 at $DIR/optimizes_into_variable.rs:15:1: 15:2
|
||||
StorageDead(_1); // bb2[11]: scope 0 at $DIR/optimizes_into_variable.rs:15:1: 15:2
|
||||
return; // bb2[12]: scope 0 at $DIR/optimizes_into_variable.rs:15:2: 15:2
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
// MIR for `main` after SimplifyLocals
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:11:11: 11:11
|
||||
let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:12:9: 12:10
|
||||
let mut _3: [i32; 6]; // in scope 0 at $DIR/optimizes_into_variable.rs:13:13: 13:31
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:12:9: 12:10
|
||||
let _2: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:13:9: 13:10
|
||||
scope 2 {
|
||||
debug y => _2; // in scope 2 at $DIR/optimizes_into_variable.rs:13:9: 13:10
|
||||
let _4: u32; // in scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10
|
||||
scope 3 {
|
||||
debug z => _4; // in scope 3 at $DIR/optimizes_into_variable.rs:14:9: 14:10
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/optimizes_into_variable.rs:12:9: 12:10
|
||||
_1 = const 4i32; // bb0[1]: scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000004))
|
||||
// mir::Constant
|
||||
// + span: $DIR/optimizes_into_variable.rs:12:13: 12:18
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000004)) }
|
||||
StorageLive(_2); // bb0[2]: scope 1 at $DIR/optimizes_into_variable.rs:13:9: 13:10
|
||||
StorageLive(_3); // bb0[3]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:31
|
||||
_3 = [const 0i32, const 1i32, const 2i32, const 3i32, const 4i32, const 5i32]; // bb0[4]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:31
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000000))
|
||||
// mir::Constant
|
||||
// + span: $DIR/optimizes_into_variable.rs:13:14: 13:15
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000000)) }
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000001))
|
||||
// mir::Constant
|
||||
// + span: $DIR/optimizes_into_variable.rs:13:17: 13:18
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) }
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000002))
|
||||
// mir::Constant
|
||||
// + span: $DIR/optimizes_into_variable.rs:13:20: 13:21
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) }
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000003))
|
||||
// mir::Constant
|
||||
// + span: $DIR/optimizes_into_variable.rs:13:23: 13:24
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000003)) }
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000004))
|
||||
// mir::Constant
|
||||
// + span: $DIR/optimizes_into_variable.rs:13:26: 13:27
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000004)) }
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000005))
|
||||
// mir::Constant
|
||||
// + span: $DIR/optimizes_into_variable.rs:13:29: 13:30
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000005)) }
|
||||
_2 = const 3i32; // bb0[5]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000003))
|
||||
// mir::Constant
|
||||
// + span: $DIR/optimizes_into_variable.rs:13:13: 13:34
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000003)) }
|
||||
StorageDead(_3); // bb0[6]: scope 1 at $DIR/optimizes_into_variable.rs:13:34: 13:35
|
||||
StorageLive(_4); // bb0[7]: scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10
|
||||
_4 = const 42u32; // bb0[8]: scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:38
|
||||
// ty::Const
|
||||
// + ty: u32
|
||||
// + val: Value(Scalar(0x0000002a))
|
||||
// mir::Constant
|
||||
// + span: $DIR/optimizes_into_variable.rs:14:13: 14:38
|
||||
// + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) }
|
||||
StorageDead(_4); // bb0[9]: scope 2 at $DIR/optimizes_into_variable.rs:15:1: 15:2
|
||||
StorageDead(_2); // bb0[10]: scope 1 at $DIR/optimizes_into_variable.rs:15:1: 15:2
|
||||
StorageDead(_1); // bb0[11]: scope 0 at $DIR/optimizes_into_variable.rs:15:1: 15:2
|
||||
return; // bb0[12]: scope 0 at $DIR/optimizes_into_variable.rs:15:2: 15:2
|
||||
}
|
||||
}
|
|
@ -0,0 +1,181 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:11:11: 11:11
|
||||
let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:12:9: 12:10
|
||||
let mut _2: (i32, bool); // in scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
|
||||
let mut _4: [i32; 6]; // in scope 0 at $DIR/optimizes_into_variable.rs:13:13: 13:31
|
||||
let _5: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:13:32: 13:33
|
||||
let mut _6: usize; // in scope 0 at $DIR/optimizes_into_variable.rs:13:13: 13:34
|
||||
let mut _7: bool; // in scope 0 at $DIR/optimizes_into_variable.rs:13:13: 13:34
|
||||
let mut _9: Point; // in scope 0 at $DIR/optimizes_into_variable.rs:14:13: 14:36
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:12:9: 12:10
|
||||
let _3: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:13:9: 13:10
|
||||
scope 2 {
|
||||
debug y => _3; // in scope 2 at $DIR/optimizes_into_variable.rs:13:9: 13:10
|
||||
let _8: u32; // in scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10
|
||||
scope 3 {
|
||||
debug z => _8; // in scope 3 at $DIR/optimizes_into_variable.rs:14:9: 14:10
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/optimizes_into_variable.rs:12:9: 12:10
|
||||
- _2 = CheckedAdd(const 2i32, const 2i32); // bb0[1]: scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
|
||||
+ _2 = (const 4i32, const false); // bb0[1]: scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
- // + val: Value(Scalar(0x00000002))
|
||||
+ // + val: Value(Scalar(0x00000004))
|
||||
// mir::Constant
|
||||
- // + span: $DIR/optimizes_into_variable.rs:12:13: 12:14
|
||||
- // + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) }
|
||||
+ // + span: $DIR/optimizes_into_variable.rs:12:13: 12:18
|
||||
+ // + literal: Const { ty: i32, val: Value(Scalar(0x00000004)) }
|
||||
// ty::Const
|
||||
- // + ty: i32
|
||||
- // + val: Value(Scalar(0x00000002))
|
||||
+ // + ty: bool
|
||||
+ // + val: Value(Scalar(0x00))
|
||||
// mir::Constant
|
||||
- // + span: $DIR/optimizes_into_variable.rs:12:17: 12:18
|
||||
- // + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) }
|
||||
- assert(!move (_2.1: bool), "attempt to add with overflow") -> bb1; // bb0[2]: scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
|
||||
+ // + span: $DIR/optimizes_into_variable.rs:12:13: 12:18
|
||||
+ // + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
|
||||
+ assert(!const false, "attempt to add with overflow") -> bb1; // bb0[2]: scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
|
||||
+ // ty::Const
|
||||
+ // + ty: bool
|
||||
+ // + val: Value(Scalar(0x00))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/optimizes_into_variable.rs:12:13: 12:18
|
||||
+ // + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
- _1 = move (_2.0: i32); // bb1[0]: scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
|
||||
+ _1 = const 4i32; // bb1[0]: scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
|
||||
+ // ty::Const
|
||||
+ // + ty: i32
|
||||
+ // + val: Value(Scalar(0x00000004))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/optimizes_into_variable.rs:12:13: 12:18
|
||||
+ // + literal: Const { ty: i32, val: Value(Scalar(0x00000004)) }
|
||||
StorageLive(_3); // bb1[1]: scope 1 at $DIR/optimizes_into_variable.rs:13:9: 13:10
|
||||
StorageLive(_4); // bb1[2]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:31
|
||||
_4 = [const 0i32, const 1i32, const 2i32, const 3i32, const 4i32, const 5i32]; // bb1[3]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:31
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000000))
|
||||
// mir::Constant
|
||||
// + span: $DIR/optimizes_into_variable.rs:13:14: 13:15
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000000)) }
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000001))
|
||||
// mir::Constant
|
||||
// + span: $DIR/optimizes_into_variable.rs:13:17: 13:18
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) }
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000002))
|
||||
// mir::Constant
|
||||
// + span: $DIR/optimizes_into_variable.rs:13:20: 13:21
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) }
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000003))
|
||||
// mir::Constant
|
||||
// + span: $DIR/optimizes_into_variable.rs:13:23: 13:24
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000003)) }
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000004))
|
||||
// mir::Constant
|
||||
// + span: $DIR/optimizes_into_variable.rs:13:26: 13:27
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000004)) }
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000005))
|
||||
// mir::Constant
|
||||
// + span: $DIR/optimizes_into_variable.rs:13:29: 13:30
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000005)) }
|
||||
StorageLive(_5); // bb1[4]: scope 1 at $DIR/optimizes_into_variable.rs:13:32: 13:33
|
||||
_5 = const 3usize; // bb1[5]: scope 1 at $DIR/optimizes_into_variable.rs:13:32: 13:33
|
||||
// ty::Const
|
||||
// + ty: usize
|
||||
// + val: Value(Scalar(0x0000000000000003))
|
||||
// mir::Constant
|
||||
// + span: $DIR/optimizes_into_variable.rs:13:32: 13:33
|
||||
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000003)) }
|
||||
_6 = const 6usize; // bb1[6]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
|
||||
// ty::Const
|
||||
// + ty: usize
|
||||
// + val: Value(Scalar(0x0000000000000006))
|
||||
// mir::Constant
|
||||
// + span: $DIR/optimizes_into_variable.rs:13:13: 13:34
|
||||
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000006)) }
|
||||
- _7 = Lt(_5, _6); // bb1[7]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
|
||||
- assert(move _7, "index out of bounds: the len is move _6 but the index is _5") -> bb2; // bb1[8]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
|
||||
+ _7 = const true; // bb1[7]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
|
||||
+ // ty::Const
|
||||
+ // + ty: bool
|
||||
+ // + val: Value(Scalar(0x01))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/optimizes_into_variable.rs:13:13: 13:34
|
||||
+ // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
|
||||
+ assert(const true, "index out of bounds: the len is move _6 but the index is _5") -> bb2; // bb1[8]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
|
||||
+ // ty::Const
|
||||
+ // + ty: bool
|
||||
+ // + val: Value(Scalar(0x01))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/optimizes_into_variable.rs:13:13: 13:34
|
||||
+ // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
|
||||
}
|
||||
|
||||
bb2: {
|
||||
- _3 = _4[_5]; // bb2[0]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
|
||||
+ _3 = const 3i32; // bb2[0]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
|
||||
+ // ty::Const
|
||||
+ // + ty: i32
|
||||
+ // + val: Value(Scalar(0x00000003))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/optimizes_into_variable.rs:13:13: 13:34
|
||||
+ // + literal: Const { ty: i32, val: Value(Scalar(0x00000003)) }
|
||||
StorageDead(_5); // bb2[1]: scope 1 at $DIR/optimizes_into_variable.rs:13:34: 13:35
|
||||
StorageDead(_4); // bb2[2]: scope 1 at $DIR/optimizes_into_variable.rs:13:34: 13:35
|
||||
StorageLive(_8); // bb2[3]: scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10
|
||||
StorageLive(_9); // bb2[4]: scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:36
|
||||
_9 = Point { x: const 12u32, y: const 42u32 }; // bb2[5]: scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:36
|
||||
// ty::Const
|
||||
// + ty: u32
|
||||
// + val: Value(Scalar(0x0000000c))
|
||||
// mir::Constant
|
||||
// + span: $DIR/optimizes_into_variable.rs:14:25: 14:27
|
||||
// + literal: Const { ty: u32, val: Value(Scalar(0x0000000c)) }
|
||||
// ty::Const
|
||||
// + ty: u32
|
||||
// + val: Value(Scalar(0x0000002a))
|
||||
// mir::Constant
|
||||
// + span: $DIR/optimizes_into_variable.rs:14:32: 14:34
|
||||
// + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) }
|
||||
- _8 = (_9.1: u32); // bb2[6]: scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:38
|
||||
+ _8 = const 42u32; // bb2[6]: scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:38
|
||||
+ // ty::Const
|
||||
+ // + ty: u32
|
||||
+ // + val: Value(Scalar(0x0000002a))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/optimizes_into_variable.rs:14:13: 14:38
|
||||
+ // + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) }
|
||||
StorageDead(_9); // bb2[7]: scope 2 at $DIR/optimizes_into_variable.rs:14:38: 14:39
|
||||
_0 = (); // bb2[8]: scope 0 at $DIR/optimizes_into_variable.rs:11:11: 15:2
|
||||
StorageDead(_8); // bb2[9]: scope 2 at $DIR/optimizes_into_variable.rs:15:1: 15:2
|
||||
StorageDead(_3); // bb2[10]: scope 1 at $DIR/optimizes_into_variable.rs:15:1: 15:2
|
||||
StorageDead(_1); // bb2[11]: scope 0 at $DIR/optimizes_into_variable.rs:15:1: 15:2
|
||||
return; // bb2[12]: scope 0 at $DIR/optimizes_into_variable.rs:15:2: 15:2
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
// MIR for `main` after SimplifyLocals
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/optimizes_into_variable.rs:11:11: 11:11
|
||||
let _1: i32; // in scope 0 at $DIR/optimizes_into_variable.rs:12:9: 12:10
|
||||
let mut _3: [i32; 6]; // in scope 0 at $DIR/optimizes_into_variable.rs:13:13: 13:31
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/optimizes_into_variable.rs:12:9: 12:10
|
||||
let _2: i32; // in scope 1 at $DIR/optimizes_into_variable.rs:13:9: 13:10
|
||||
scope 2 {
|
||||
debug y => _2; // in scope 2 at $DIR/optimizes_into_variable.rs:13:9: 13:10
|
||||
let _4: u32; // in scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10
|
||||
scope 3 {
|
||||
debug z => _4; // in scope 3 at $DIR/optimizes_into_variable.rs:14:9: 14:10
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/optimizes_into_variable.rs:12:9: 12:10
|
||||
_1 = const 4i32; // bb0[1]: scope 0 at $DIR/optimizes_into_variable.rs:12:13: 12:18
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000004))
|
||||
// mir::Constant
|
||||
// + span: $DIR/optimizes_into_variable.rs:12:13: 12:18
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000004)) }
|
||||
StorageLive(_2); // bb0[2]: scope 1 at $DIR/optimizes_into_variable.rs:13:9: 13:10
|
||||
StorageLive(_3); // bb0[3]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:31
|
||||
_3 = [const 0i32, const 1i32, const 2i32, const 3i32, const 4i32, const 5i32]; // bb0[4]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:31
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000000))
|
||||
// mir::Constant
|
||||
// + span: $DIR/optimizes_into_variable.rs:13:14: 13:15
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000000)) }
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000001))
|
||||
// mir::Constant
|
||||
// + span: $DIR/optimizes_into_variable.rs:13:17: 13:18
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) }
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000002))
|
||||
// mir::Constant
|
||||
// + span: $DIR/optimizes_into_variable.rs:13:20: 13:21
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000002)) }
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000003))
|
||||
// mir::Constant
|
||||
// + span: $DIR/optimizes_into_variable.rs:13:23: 13:24
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000003)) }
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000004))
|
||||
// mir::Constant
|
||||
// + span: $DIR/optimizes_into_variable.rs:13:26: 13:27
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000004)) }
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000005))
|
||||
// mir::Constant
|
||||
// + span: $DIR/optimizes_into_variable.rs:13:29: 13:30
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000005)) }
|
||||
_2 = const 3i32; // bb0[5]: scope 1 at $DIR/optimizes_into_variable.rs:13:13: 13:34
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000003))
|
||||
// mir::Constant
|
||||
// + span: $DIR/optimizes_into_variable.rs:13:13: 13:34
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000003)) }
|
||||
StorageDead(_3); // bb0[6]: scope 1 at $DIR/optimizes_into_variable.rs:13:34: 13:35
|
||||
StorageLive(_4); // bb0[7]: scope 2 at $DIR/optimizes_into_variable.rs:14:9: 14:10
|
||||
_4 = const 42u32; // bb0[8]: scope 2 at $DIR/optimizes_into_variable.rs:14:13: 14:38
|
||||
// ty::Const
|
||||
// + ty: u32
|
||||
// + val: Value(Scalar(0x0000002a))
|
||||
// mir::Constant
|
||||
// + span: $DIR/optimizes_into_variable.rs:14:13: 14:38
|
||||
// + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) }
|
||||
StorageDead(_4); // bb0[9]: scope 2 at $DIR/optimizes_into_variable.rs:15:1: 15:2
|
||||
StorageDead(_2); // bb0[10]: scope 1 at $DIR/optimizes_into_variable.rs:15:1: 15:2
|
||||
StorageDead(_1); // bb0[11]: scope 0 at $DIR/optimizes_into_variable.rs:15:1: 15:2
|
||||
return; // bb0[12]: scope 0 at $DIR/optimizes_into_variable.rs:15:2: 15:2
|
||||
}
|
||||
}
|
|
@ -2,30 +2,7 @@
|
|||
|
||||
static FOO: u8 = 2;
|
||||
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
fn main() {
|
||||
let x = FOO + FOO;
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
// START rustc.main.ConstProp.before.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _3 = const {alloc0+0: &u8};
|
||||
// _2 = (*_3);
|
||||
// ...
|
||||
// _5 = const {alloc0+0: &u8};
|
||||
// _4 = (*_5);
|
||||
// _1 = Add(move _2, move _4);
|
||||
// ...
|
||||
// }
|
||||
// END rustc.main.ConstProp.before.mir
|
||||
// START rustc.main.ConstProp.after.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _2 = const 2u8;
|
||||
// ...
|
||||
// _4 = const 2u8;
|
||||
// _1 = const 4u8;
|
||||
// ...
|
||||
// }
|
||||
// END rustc.main.ConstProp.after.mir
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/read_immutable_static.rs:6:11: 6:11
|
||||
let _1: u8; // in scope 0 at $DIR/read_immutable_static.rs:7:9: 7:10
|
||||
let mut _2: u8; // in scope 0 at $DIR/read_immutable_static.rs:7:13: 7:16
|
||||
let mut _3: &u8; // in scope 0 at $DIR/read_immutable_static.rs:7:13: 7:16
|
||||
let mut _4: u8; // in scope 0 at $DIR/read_immutable_static.rs:7:19: 7:22
|
||||
let mut _5: &u8; // in scope 0 at $DIR/read_immutable_static.rs:7:19: 7:22
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/read_immutable_static.rs:7:9: 7:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/read_immutable_static.rs:7:9: 7:10
|
||||
StorageLive(_2); // bb0[1]: scope 0 at $DIR/read_immutable_static.rs:7:13: 7:16
|
||||
StorageLive(_3); // bb0[2]: scope 0 at $DIR/read_immutable_static.rs:7:13: 7:16
|
||||
_3 = const {alloc0+0: &u8}; // bb0[3]: scope 0 at $DIR/read_immutable_static.rs:7:13: 7:16
|
||||
// ty::Const
|
||||
// + ty: &u8
|
||||
// + val: Value(Scalar(alloc0+0))
|
||||
// mir::Constant
|
||||
// + span: $DIR/read_immutable_static.rs:7:13: 7:16
|
||||
// + literal: Const { ty: &u8, val: Value(Scalar(alloc0+0)) }
|
||||
- _2 = (*_3); // bb0[4]: scope 0 at $DIR/read_immutable_static.rs:7:13: 7:16
|
||||
+ _2 = const 2u8; // bb0[4]: scope 0 at $DIR/read_immutable_static.rs:7:13: 7:16
|
||||
+ // ty::Const
|
||||
+ // + ty: u8
|
||||
+ // + val: Value(Scalar(0x02))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/read_immutable_static.rs:7:13: 7:16
|
||||
+ // + literal: Const { ty: u8, val: Value(Scalar(0x02)) }
|
||||
StorageLive(_4); // bb0[5]: scope 0 at $DIR/read_immutable_static.rs:7:19: 7:22
|
||||
StorageLive(_5); // bb0[6]: scope 0 at $DIR/read_immutable_static.rs:7:19: 7:22
|
||||
_5 = const {alloc0+0: &u8}; // bb0[7]: scope 0 at $DIR/read_immutable_static.rs:7:19: 7:22
|
||||
// ty::Const
|
||||
// + ty: &u8
|
||||
// + val: Value(Scalar(alloc0+0))
|
||||
// mir::Constant
|
||||
// + span: $DIR/read_immutable_static.rs:7:19: 7:22
|
||||
// + literal: Const { ty: &u8, val: Value(Scalar(alloc0+0)) }
|
||||
- _4 = (*_5); // bb0[8]: scope 0 at $DIR/read_immutable_static.rs:7:19: 7:22
|
||||
- _1 = Add(move _2, move _4); // bb0[9]: scope 0 at $DIR/read_immutable_static.rs:7:13: 7:22
|
||||
+ _4 = const 2u8; // bb0[8]: scope 0 at $DIR/read_immutable_static.rs:7:19: 7:22
|
||||
+ // ty::Const
|
||||
+ // + ty: u8
|
||||
+ // + val: Value(Scalar(0x02))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/read_immutable_static.rs:7:19: 7:22
|
||||
+ // + literal: Const { ty: u8, val: Value(Scalar(0x02)) }
|
||||
+ _1 = const 4u8; // bb0[9]: scope 0 at $DIR/read_immutable_static.rs:7:13: 7:22
|
||||
+ // ty::Const
|
||||
+ // + ty: u8
|
||||
+ // + val: Value(Scalar(0x04))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/read_immutable_static.rs:7:13: 7:22
|
||||
+ // + literal: Const { ty: u8, val: Value(Scalar(0x04)) }
|
||||
StorageDead(_4); // bb0[10]: scope 0 at $DIR/read_immutable_static.rs:7:21: 7:22
|
||||
StorageDead(_2); // bb0[11]: scope 0 at $DIR/read_immutable_static.rs:7:21: 7:22
|
||||
StorageDead(_5); // bb0[12]: scope 0 at $DIR/read_immutable_static.rs:7:22: 7:23
|
||||
StorageDead(_3); // bb0[13]: scope 0 at $DIR/read_immutable_static.rs:7:22: 7:23
|
||||
_0 = (); // bb0[14]: scope 0 at $DIR/read_immutable_static.rs:6:11: 8:2
|
||||
StorageDead(_1); // bb0[15]: scope 0 at $DIR/read_immutable_static.rs:8:1: 8:2
|
||||
return; // bb0[16]: scope 0 at $DIR/read_immutable_static.rs:8:2: 8:2
|
||||
}
|
||||
}
|
||||
|
||||
alloc0 (static: FOO, size: 1, align: 1) {
|
||||
02 │ .
|
||||
}
|
||||
|
|
@ -1,41 +1,6 @@
|
|||
// EMIT_MIR rustc.main.PromoteTemps.diff
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
|
||||
fn main() {
|
||||
*(&4);
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
// START rustc.main.PromoteTemps.before.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _3 = const 4i32;
|
||||
// _2 = &_3;
|
||||
// _1 = (*_2);
|
||||
// ...
|
||||
//}
|
||||
// END rustc.main.PromoteTemps.before.mir
|
||||
// START rustc.main.PromoteTemps.after.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _4 = const main::promoted[0];
|
||||
// _2 = &(*_4);
|
||||
// _1 = (*_2);
|
||||
// ...
|
||||
//}
|
||||
// END rustc.main.PromoteTemps.after.mir
|
||||
// START rustc.main.ConstProp.before.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _4 = const main::promoted[0];
|
||||
// _2 = _4;
|
||||
// _1 = (*_2);
|
||||
// ...
|
||||
//}
|
||||
// END rustc.main.ConstProp.before.mir
|
||||
// START rustc.main.ConstProp.after.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _4 = const main::promoted[0];
|
||||
// _2 = _4;
|
||||
// _1 = const 4i32;
|
||||
// ...
|
||||
// }
|
||||
// END rustc.main.ConstProp.after.mir
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/ref_deref.rs:4:11: 4:11
|
||||
let _1: i32; // in scope 0 at $DIR/ref_deref.rs:5:5: 5:10
|
||||
let mut _2: &i32; // in scope 0 at $DIR/ref_deref.rs:5:6: 5:10
|
||||
let _3: i32; // in scope 0 at $DIR/ref_deref.rs:5:8: 5:9
|
||||
let mut _4: &i32; // in scope 0 at $DIR/ref_deref.rs:5:6: 5:10
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/ref_deref.rs:5:5: 5:10
|
||||
StorageLive(_2); // bb0[1]: scope 0 at $DIR/ref_deref.rs:5:6: 5:10
|
||||
_4 = const main::promoted[0]; // bb0[2]: scope 0 at $DIR/ref_deref.rs:5:6: 5:10
|
||||
// ty::Const
|
||||
// + ty: &i32
|
||||
// + val: Unevaluated(DefId(0:3 ~ ref_deref[317d]::main[0]), [], Some(promoted[0]))
|
||||
// mir::Constant
|
||||
// + span: $DIR/ref_deref.rs:5:6: 5:10
|
||||
// + literal: Const { ty: &i32, val: Unevaluated(DefId(0:3 ~ ref_deref[317d]::main[0]), [], Some(promoted[0])) }
|
||||
_2 = _4; // bb0[3]: scope 0 at $DIR/ref_deref.rs:5:6: 5:10
|
||||
- _1 = (*_2); // bb0[4]: scope 0 at $DIR/ref_deref.rs:5:5: 5:10
|
||||
+ _1 = const 4i32; // bb0[4]: scope 0 at $DIR/ref_deref.rs:5:5: 5:10
|
||||
+ // ty::Const
|
||||
+ // + ty: i32
|
||||
+ // + val: Value(Scalar(0x00000004))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/ref_deref.rs:5:5: 5:10
|
||||
+ // + literal: Const { ty: i32, val: Value(Scalar(0x00000004)) }
|
||||
StorageDead(_2); // bb0[5]: scope 0 at $DIR/ref_deref.rs:5:10: 5:11
|
||||
StorageDead(_1); // bb0[6]: scope 0 at $DIR/ref_deref.rs:5:10: 5:11
|
||||
_0 = (); // bb0[7]: scope 0 at $DIR/ref_deref.rs:4:11: 6:2
|
||||
return; // bb0[8]: scope 0 at $DIR/ref_deref.rs:6:2: 6:2
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
- // MIR for `main` before PromoteTemps
|
||||
+ // MIR for `main` after PromoteTemps
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/ref_deref.rs:4:11: 4:11
|
||||
let _1: i32; // in scope 0 at $DIR/ref_deref.rs:5:5: 5:10
|
||||
let mut _2: &i32; // in scope 0 at $DIR/ref_deref.rs:5:6: 5:10
|
||||
let _3: i32; // in scope 0 at $DIR/ref_deref.rs:5:8: 5:9
|
||||
+ let mut _4: &i32; // in scope 0 at $DIR/ref_deref.rs:5:6: 5:10
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/ref_deref.rs:5:5: 5:10
|
||||
StorageLive(_2); // bb0[1]: scope 0 at $DIR/ref_deref.rs:5:6: 5:10
|
||||
- StorageLive(_3); // bb0[2]: scope 0 at $DIR/ref_deref.rs:5:8: 5:9
|
||||
- _3 = const 4i32; // bb0[3]: scope 0 at $DIR/ref_deref.rs:5:8: 5:9
|
||||
+ _4 = const main::promoted[0]; // bb0[2]: scope 0 at $DIR/ref_deref.rs:5:6: 5:10
|
||||
// ty::Const
|
||||
- // + ty: i32
|
||||
- // + val: Value(Scalar(0x00000004))
|
||||
+ // + ty: &i32
|
||||
+ // + val: Unevaluated(DefId(0:3 ~ ref_deref[317d]::main[0]), [], Some(promoted[0]))
|
||||
// mir::Constant
|
||||
- // + span: $DIR/ref_deref.rs:5:8: 5:9
|
||||
- // + literal: Const { ty: i32, val: Value(Scalar(0x00000004)) }
|
||||
- _2 = &_3; // bb0[4]: scope 0 at $DIR/ref_deref.rs:5:6: 5:10
|
||||
- _1 = (*_2); // bb0[5]: scope 0 at $DIR/ref_deref.rs:5:5: 5:10
|
||||
- StorageDead(_3); // bb0[6]: scope 0 at $DIR/ref_deref.rs:5:10: 5:11
|
||||
- StorageDead(_2); // bb0[7]: scope 0 at $DIR/ref_deref.rs:5:10: 5:11
|
||||
- StorageDead(_1); // bb0[8]: scope 0 at $DIR/ref_deref.rs:5:10: 5:11
|
||||
- _0 = (); // bb0[9]: scope 0 at $DIR/ref_deref.rs:4:11: 6:2
|
||||
- return; // bb0[10]: scope 0 at $DIR/ref_deref.rs:6:2: 6:2
|
||||
+ // + span: $DIR/ref_deref.rs:5:6: 5:10
|
||||
+ // + literal: Const { ty: &i32, val: Unevaluated(DefId(0:3 ~ ref_deref[317d]::main[0]), [], Some(promoted[0])) }
|
||||
+ _2 = &(*_4); // bb0[3]: scope 0 at $DIR/ref_deref.rs:5:6: 5:10
|
||||
+ _1 = (*_2); // bb0[4]: scope 0 at $DIR/ref_deref.rs:5:5: 5:10
|
||||
+ StorageDead(_2); // bb0[5]: scope 0 at $DIR/ref_deref.rs:5:10: 5:11
|
||||
+ StorageDead(_1); // bb0[6]: scope 0 at $DIR/ref_deref.rs:5:10: 5:11
|
||||
+ _0 = (); // bb0[7]: scope 0 at $DIR/ref_deref.rs:4:11: 6:2
|
||||
+ return; // bb0[8]: scope 0 at $DIR/ref_deref.rs:6:2: 6:2
|
||||
}
|
||||
}
|
||||
|
|
@ -1,41 +1,6 @@
|
|||
// EMIT_MIR rustc.main.PromoteTemps.diff
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
|
||||
fn main() {
|
||||
*(&(4, 5).1); // This does not currently propagate (#67862)
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
// START rustc.main.PromoteTemps.before.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _3 = (const 4i32, const 5i32);
|
||||
// _2 = &(_3.1: i32);
|
||||
// _1 = (*_2);
|
||||
// ...
|
||||
//}
|
||||
// END rustc.main.PromoteTemps.before.mir
|
||||
// START rustc.main.PromoteTemps.after.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _4 = const main::promoted[0];
|
||||
// _2 = &((*_4).1: i32);
|
||||
// _1 = (*_2);
|
||||
// ...
|
||||
//}
|
||||
// END rustc.main.PromoteTemps.after.mir
|
||||
// START rustc.main.ConstProp.before.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _4 = const main::promoted[0];
|
||||
// _2 = &((*_4).1: i32);
|
||||
// _1 = (*_2);
|
||||
// ...
|
||||
//}
|
||||
// END rustc.main.ConstProp.before.mir
|
||||
// START rustc.main.ConstProp.after.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _4 = const main::promoted[0];
|
||||
// _2 = &((*_4).1: i32);
|
||||
// _1 = (*_2);
|
||||
// ...
|
||||
// }
|
||||
// END rustc.main.ConstProp.after.mir
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/ref_deref_project.rs:4:11: 4:11
|
||||
let _1: i32; // in scope 0 at $DIR/ref_deref_project.rs:5:5: 5:17
|
||||
let mut _2: &i32; // in scope 0 at $DIR/ref_deref_project.rs:5:6: 5:17
|
||||
let _3: (i32, i32); // in scope 0 at $DIR/ref_deref_project.rs:5:8: 5:14
|
||||
let mut _4: &(i32, i32); // in scope 0 at $DIR/ref_deref_project.rs:5:6: 5:17
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/ref_deref_project.rs:5:5: 5:17
|
||||
StorageLive(_2); // bb0[1]: scope 0 at $DIR/ref_deref_project.rs:5:6: 5:17
|
||||
_4 = const main::promoted[0]; // bb0[2]: scope 0 at $DIR/ref_deref_project.rs:5:6: 5:17
|
||||
// ty::Const
|
||||
// + ty: &(i32, i32)
|
||||
// + val: Unevaluated(DefId(0:3 ~ ref_deref_project[317d]::main[0]), [], Some(promoted[0]))
|
||||
// mir::Constant
|
||||
// + span: $DIR/ref_deref_project.rs:5:6: 5:17
|
||||
// + literal: Const { ty: &(i32, i32), val: Unevaluated(DefId(0:3 ~ ref_deref_project[317d]::main[0]), [], Some(promoted[0])) }
|
||||
_2 = &((*_4).1: i32); // bb0[3]: scope 0 at $DIR/ref_deref_project.rs:5:6: 5:17
|
||||
_1 = (*_2); // bb0[4]: scope 0 at $DIR/ref_deref_project.rs:5:5: 5:17
|
||||
StorageDead(_2); // bb0[5]: scope 0 at $DIR/ref_deref_project.rs:5:17: 5:18
|
||||
StorageDead(_1); // bb0[6]: scope 0 at $DIR/ref_deref_project.rs:5:17: 5:18
|
||||
_0 = (); // bb0[7]: scope 0 at $DIR/ref_deref_project.rs:4:11: 6:2
|
||||
return; // bb0[8]: scope 0 at $DIR/ref_deref_project.rs:6:2: 6:2
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
- // MIR for `main` before PromoteTemps
|
||||
+ // MIR for `main` after PromoteTemps
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/ref_deref_project.rs:4:11: 4:11
|
||||
let _1: i32; // in scope 0 at $DIR/ref_deref_project.rs:5:5: 5:17
|
||||
let mut _2: &i32; // in scope 0 at $DIR/ref_deref_project.rs:5:6: 5:17
|
||||
let _3: (i32, i32); // in scope 0 at $DIR/ref_deref_project.rs:5:8: 5:14
|
||||
+ let mut _4: &(i32, i32); // in scope 0 at $DIR/ref_deref_project.rs:5:6: 5:17
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/ref_deref_project.rs:5:5: 5:17
|
||||
StorageLive(_2); // bb0[1]: scope 0 at $DIR/ref_deref_project.rs:5:6: 5:17
|
||||
- StorageLive(_3); // bb0[2]: scope 0 at $DIR/ref_deref_project.rs:5:8: 5:14
|
||||
- _3 = (const 4i32, const 5i32); // bb0[3]: scope 0 at $DIR/ref_deref_project.rs:5:8: 5:14
|
||||
+ _4 = const main::promoted[0]; // bb0[2]: scope 0 at $DIR/ref_deref_project.rs:5:6: 5:17
|
||||
// ty::Const
|
||||
- // + ty: i32
|
||||
- // + val: Value(Scalar(0x00000004))
|
||||
+ // + ty: &(i32, i32)
|
||||
+ // + val: Unevaluated(DefId(0:3 ~ ref_deref_project[317d]::main[0]), [], Some(promoted[0]))
|
||||
// mir::Constant
|
||||
- // + span: $DIR/ref_deref_project.rs:5:9: 5:10
|
||||
- // + literal: Const { ty: i32, val: Value(Scalar(0x00000004)) }
|
||||
- // ty::Const
|
||||
- // + ty: i32
|
||||
- // + val: Value(Scalar(0x00000005))
|
||||
- // mir::Constant
|
||||
- // + span: $DIR/ref_deref_project.rs:5:12: 5:13
|
||||
- // + literal: Const { ty: i32, val: Value(Scalar(0x00000005)) }
|
||||
- _2 = &(_3.1: i32); // bb0[4]: scope 0 at $DIR/ref_deref_project.rs:5:6: 5:17
|
||||
- _1 = (*_2); // bb0[5]: scope 0 at $DIR/ref_deref_project.rs:5:5: 5:17
|
||||
- StorageDead(_3); // bb0[6]: scope 0 at $DIR/ref_deref_project.rs:5:17: 5:18
|
||||
- StorageDead(_2); // bb0[7]: scope 0 at $DIR/ref_deref_project.rs:5:17: 5:18
|
||||
- StorageDead(_1); // bb0[8]: scope 0 at $DIR/ref_deref_project.rs:5:17: 5:18
|
||||
- _0 = (); // bb0[9]: scope 0 at $DIR/ref_deref_project.rs:4:11: 6:2
|
||||
- return; // bb0[10]: scope 0 at $DIR/ref_deref_project.rs:6:2: 6:2
|
||||
+ // + span: $DIR/ref_deref_project.rs:5:6: 5:17
|
||||
+ // + literal: Const { ty: &(i32, i32), val: Unevaluated(DefId(0:3 ~ ref_deref_project[317d]::main[0]), [], Some(promoted[0])) }
|
||||
+ _2 = &((*_4).1: i32); // bb0[3]: scope 0 at $DIR/ref_deref_project.rs:5:6: 5:17
|
||||
+ _1 = (*_2); // bb0[4]: scope 0 at $DIR/ref_deref_project.rs:5:5: 5:17
|
||||
+ StorageDead(_2); // bb0[5]: scope 0 at $DIR/ref_deref_project.rs:5:17: 5:18
|
||||
+ StorageDead(_1); // bb0[6]: scope 0 at $DIR/ref_deref_project.rs:5:17: 5:18
|
||||
+ _0 = (); // bb0[7]: scope 0 at $DIR/ref_deref_project.rs:4:11: 6:2
|
||||
+ return; // bb0[8]: scope 0 at $DIR/ref_deref_project.rs:6:2: 6:2
|
||||
}
|
||||
}
|
||||
|
|
@ -1,25 +1,5 @@
|
|||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
|
||||
fn main() {
|
||||
let _ = main as usize as *const fn();
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
// START rustc.main.ConstProp.before.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _3 = const main as fn() (Pointer(ReifyFnPointer));
|
||||
// _2 = move _3 as usize (Misc);
|
||||
// ...
|
||||
// _1 = move _2 as *const fn() (Misc);
|
||||
// ...
|
||||
// }
|
||||
// END rustc.main.ConstProp.before.mir
|
||||
// START rustc.main.ConstProp.after.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _3 = const main as fn() (Pointer(ReifyFnPointer));
|
||||
// _2 = move _3 as usize (Misc);
|
||||
// ...
|
||||
// _1 = move _2 as *const fn() (Misc);
|
||||
// ...
|
||||
// }
|
||||
// END rustc.main.ConstProp.after.mir
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/reify_fn_ptr.rs:3:11: 3:11
|
||||
let mut _1: *const fn(); // in scope 0 at $DIR/reify_fn_ptr.rs:4:13: 4:41
|
||||
let mut _2: usize; // in scope 0 at $DIR/reify_fn_ptr.rs:4:13: 4:26
|
||||
let mut _3: fn(); // in scope 0 at $DIR/reify_fn_ptr.rs:4:13: 4:17
|
||||
scope 1 {
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/reify_fn_ptr.rs:4:13: 4:41
|
||||
StorageLive(_2); // bb0[1]: scope 0 at $DIR/reify_fn_ptr.rs:4:13: 4:26
|
||||
StorageLive(_3); // bb0[2]: scope 0 at $DIR/reify_fn_ptr.rs:4:13: 4:17
|
||||
_3 = const main as fn() (Pointer(ReifyFnPointer)); // bb0[3]: scope 0 at $DIR/reify_fn_ptr.rs:4:13: 4:17
|
||||
// ty::Const
|
||||
// + ty: fn() {main}
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $DIR/reify_fn_ptr.rs:4:13: 4:17
|
||||
// + literal: Const { ty: fn() {main}, val: Value(Scalar(<ZST>)) }
|
||||
_2 = move _3 as usize (Misc); // bb0[4]: scope 0 at $DIR/reify_fn_ptr.rs:4:13: 4:26
|
||||
StorageDead(_3); // bb0[5]: scope 0 at $DIR/reify_fn_ptr.rs:4:25: 4:26
|
||||
_1 = move _2 as *const fn() (Misc); // bb0[6]: scope 0 at $DIR/reify_fn_ptr.rs:4:13: 4:41
|
||||
StorageDead(_2); // bb0[7]: scope 0 at $DIR/reify_fn_ptr.rs:4:40: 4:41
|
||||
StorageDead(_1); // bb0[8]: scope 0 at $DIR/reify_fn_ptr.rs:4:41: 4:42
|
||||
_0 = (); // bb0[9]: scope 0 at $DIR/reify_fn_ptr.rs:3:11: 5:2
|
||||
return; // bb0[10]: scope 0 at $DIR/reify_fn_ptr.rs:5:2: 5:2
|
||||
}
|
||||
}
|
||||
|
|
@ -1,37 +1,7 @@
|
|||
// compile-flags: -O
|
||||
|
||||
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
fn main() {
|
||||
let x: u32 = [42; 8][2] + 0;
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
// START rustc.main.ConstProp.before.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _3 = [const 42u32; 8];
|
||||
// ...
|
||||
// _4 = const 2usize;
|
||||
// _5 = const 8usize;
|
||||
// _6 = Lt(_4, _5);
|
||||
// assert(move _6, "index out of bounds: the len is move _5 but the index is _4") -> bb1;
|
||||
// }
|
||||
// bb1: {
|
||||
// _2 = _3[_4];
|
||||
// _1 = Add(move _2, const 0u32);
|
||||
// ...
|
||||
// return;
|
||||
// }
|
||||
// END rustc.main.ConstProp.before.mir
|
||||
// START rustc.main.ConstProp.after.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _6 = const true;
|
||||
// assert(const true, "index out of bounds: the len is move _5 but the index is _4") -> bb1;
|
||||
// }
|
||||
// bb1: {
|
||||
// _2 = const 42u32;
|
||||
// _1 = const 42u32;
|
||||
// ...
|
||||
// return;
|
||||
// }
|
||||
// END rustc.main.ConstProp.after.mir
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/repeat.rs:5:11: 5:11
|
||||
let _1: u32 as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 0 at $DIR/repeat.rs:6:9: 6:10
|
||||
let mut _2: u32; // in scope 0 at $DIR/repeat.rs:6:18: 6:28
|
||||
let mut _3: [u32; 8]; // in scope 0 at $DIR/repeat.rs:6:18: 6:25
|
||||
let _4: usize; // in scope 0 at $DIR/repeat.rs:6:26: 6:27
|
||||
let mut _5: usize; // in scope 0 at $DIR/repeat.rs:6:18: 6:28
|
||||
let mut _6: bool; // in scope 0 at $DIR/repeat.rs:6:18: 6:28
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/repeat.rs:6:9: 6:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/repeat.rs:6:9: 6:10
|
||||
StorageLive(_2); // bb0[1]: scope 0 at $DIR/repeat.rs:6:18: 6:28
|
||||
StorageLive(_3); // bb0[2]: scope 0 at $DIR/repeat.rs:6:18: 6:25
|
||||
_3 = [const 42u32; 8]; // bb0[3]: scope 0 at $DIR/repeat.rs:6:18: 6:25
|
||||
// ty::Const
|
||||
// + ty: u32
|
||||
// + val: Value(Scalar(0x0000002a))
|
||||
// mir::Constant
|
||||
// + span: $DIR/repeat.rs:6:19: 6:21
|
||||
// + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) }
|
||||
StorageLive(_4); // bb0[4]: scope 0 at $DIR/repeat.rs:6:26: 6:27
|
||||
_4 = const 2usize; // bb0[5]: scope 0 at $DIR/repeat.rs:6:26: 6:27
|
||||
// ty::Const
|
||||
// + ty: usize
|
||||
// + val: Value(Scalar(0x00000002))
|
||||
// mir::Constant
|
||||
// + span: $DIR/repeat.rs:6:26: 6:27
|
||||
// + literal: Const { ty: usize, val: Value(Scalar(0x00000002)) }
|
||||
_5 = const 8usize; // bb0[6]: scope 0 at $DIR/repeat.rs:6:18: 6:28
|
||||
// ty::Const
|
||||
// + ty: usize
|
||||
// + val: Value(Scalar(0x00000008))
|
||||
// mir::Constant
|
||||
// + span: $DIR/repeat.rs:6:18: 6:28
|
||||
// + literal: Const { ty: usize, val: Value(Scalar(0x00000008)) }
|
||||
- _6 = Lt(_4, _5); // bb0[7]: scope 0 at $DIR/repeat.rs:6:18: 6:28
|
||||
- assert(move _6, "index out of bounds: the len is move _5 but the index is _4") -> bb1; // bb0[8]: scope 0 at $DIR/repeat.rs:6:18: 6:28
|
||||
+ _6 = const true; // bb0[7]: scope 0 at $DIR/repeat.rs:6:18: 6:28
|
||||
+ // ty::Const
|
||||
+ // + ty: bool
|
||||
+ // + val: Value(Scalar(0x01))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/repeat.rs:6:18: 6:28
|
||||
+ // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
|
||||
+ assert(const true, "index out of bounds: the len is move _5 but the index is _4") -> bb1; // bb0[8]: scope 0 at $DIR/repeat.rs:6:18: 6:28
|
||||
+ // ty::Const
|
||||
+ // + ty: bool
|
||||
+ // + val: Value(Scalar(0x01))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/repeat.rs:6:18: 6:28
|
||||
+ // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
- _2 = _3[_4]; // bb1[0]: scope 0 at $DIR/repeat.rs:6:18: 6:28
|
||||
- _1 = Add(move _2, const 0u32); // bb1[1]: scope 0 at $DIR/repeat.rs:6:18: 6:32
|
||||
+ _2 = const 42u32; // bb1[0]: scope 0 at $DIR/repeat.rs:6:18: 6:28
|
||||
// ty::Const
|
||||
// + ty: u32
|
||||
- // + val: Value(Scalar(0x00000000))
|
||||
+ // + val: Value(Scalar(0x0000002a))
|
||||
// mir::Constant
|
||||
- // + span: $DIR/repeat.rs:6:31: 6:32
|
||||
- // + literal: Const { ty: u32, val: Value(Scalar(0x00000000)) }
|
||||
+ // + span: $DIR/repeat.rs:6:18: 6:28
|
||||
+ // + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) }
|
||||
+ _1 = const 42u32; // bb1[1]: scope 0 at $DIR/repeat.rs:6:18: 6:32
|
||||
+ // ty::Const
|
||||
+ // + ty: u32
|
||||
+ // + val: Value(Scalar(0x0000002a))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/repeat.rs:6:18: 6:32
|
||||
+ // + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) }
|
||||
StorageDead(_2); // bb1[2]: scope 0 at $DIR/repeat.rs:6:31: 6:32
|
||||
StorageDead(_4); // bb1[3]: scope 0 at $DIR/repeat.rs:6:32: 6:33
|
||||
StorageDead(_3); // bb1[4]: scope 0 at $DIR/repeat.rs:6:32: 6:33
|
||||
_0 = (); // bb1[5]: scope 0 at $DIR/repeat.rs:5:11: 7:2
|
||||
StorageDead(_1); // bb1[6]: scope 0 at $DIR/repeat.rs:7:1: 7:2
|
||||
return; // bb1[7]: scope 0 at $DIR/repeat.rs:7:2: 7:2
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/repeat.rs:5:11: 5:11
|
||||
let _1: u32 as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 0 at $DIR/repeat.rs:6:9: 6:10
|
||||
let mut _2: u32; // in scope 0 at $DIR/repeat.rs:6:18: 6:28
|
||||
let mut _3: [u32; 8]; // in scope 0 at $DIR/repeat.rs:6:18: 6:25
|
||||
let _4: usize; // in scope 0 at $DIR/repeat.rs:6:26: 6:27
|
||||
let mut _5: usize; // in scope 0 at $DIR/repeat.rs:6:18: 6:28
|
||||
let mut _6: bool; // in scope 0 at $DIR/repeat.rs:6:18: 6:28
|
||||
scope 1 {
|
||||
debug x => _1; // in scope 1 at $DIR/repeat.rs:6:9: 6:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/repeat.rs:6:9: 6:10
|
||||
StorageLive(_2); // bb0[1]: scope 0 at $DIR/repeat.rs:6:18: 6:28
|
||||
StorageLive(_3); // bb0[2]: scope 0 at $DIR/repeat.rs:6:18: 6:25
|
||||
_3 = [const 42u32; 8]; // bb0[3]: scope 0 at $DIR/repeat.rs:6:18: 6:25
|
||||
// ty::Const
|
||||
// + ty: u32
|
||||
// + val: Value(Scalar(0x0000002a))
|
||||
// mir::Constant
|
||||
// + span: $DIR/repeat.rs:6:19: 6:21
|
||||
// + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) }
|
||||
StorageLive(_4); // bb0[4]: scope 0 at $DIR/repeat.rs:6:26: 6:27
|
||||
_4 = const 2usize; // bb0[5]: scope 0 at $DIR/repeat.rs:6:26: 6:27
|
||||
// ty::Const
|
||||
// + ty: usize
|
||||
// + val: Value(Scalar(0x0000000000000002))
|
||||
// mir::Constant
|
||||
// + span: $DIR/repeat.rs:6:26: 6:27
|
||||
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000002)) }
|
||||
_5 = const 8usize; // bb0[6]: scope 0 at $DIR/repeat.rs:6:18: 6:28
|
||||
// ty::Const
|
||||
// + ty: usize
|
||||
// + val: Value(Scalar(0x0000000000000008))
|
||||
// mir::Constant
|
||||
// + span: $DIR/repeat.rs:6:18: 6:28
|
||||
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000008)) }
|
||||
- _6 = Lt(_4, _5); // bb0[7]: scope 0 at $DIR/repeat.rs:6:18: 6:28
|
||||
- assert(move _6, "index out of bounds: the len is move _5 but the index is _4") -> bb1; // bb0[8]: scope 0 at $DIR/repeat.rs:6:18: 6:28
|
||||
+ _6 = const true; // bb0[7]: scope 0 at $DIR/repeat.rs:6:18: 6:28
|
||||
+ // ty::Const
|
||||
+ // + ty: bool
|
||||
+ // + val: Value(Scalar(0x01))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/repeat.rs:6:18: 6:28
|
||||
+ // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
|
||||
+ assert(const true, "index out of bounds: the len is move _5 but the index is _4") -> bb1; // bb0[8]: scope 0 at $DIR/repeat.rs:6:18: 6:28
|
||||
+ // ty::Const
|
||||
+ // + ty: bool
|
||||
+ // + val: Value(Scalar(0x01))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/repeat.rs:6:18: 6:28
|
||||
+ // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
- _2 = _3[_4]; // bb1[0]: scope 0 at $DIR/repeat.rs:6:18: 6:28
|
||||
- _1 = Add(move _2, const 0u32); // bb1[1]: scope 0 at $DIR/repeat.rs:6:18: 6:32
|
||||
+ _2 = const 42u32; // bb1[0]: scope 0 at $DIR/repeat.rs:6:18: 6:28
|
||||
// ty::Const
|
||||
// + ty: u32
|
||||
- // + val: Value(Scalar(0x00000000))
|
||||
+ // + val: Value(Scalar(0x0000002a))
|
||||
// mir::Constant
|
||||
- // + span: $DIR/repeat.rs:6:31: 6:32
|
||||
- // + literal: Const { ty: u32, val: Value(Scalar(0x00000000)) }
|
||||
+ // + span: $DIR/repeat.rs:6:18: 6:28
|
||||
+ // + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) }
|
||||
+ _1 = const 42u32; // bb1[1]: scope 0 at $DIR/repeat.rs:6:18: 6:32
|
||||
+ // ty::Const
|
||||
+ // + ty: u32
|
||||
+ // + val: Value(Scalar(0x0000002a))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/repeat.rs:6:18: 6:32
|
||||
+ // + literal: Const { ty: u32, val: Value(Scalar(0x0000002a)) }
|
||||
StorageDead(_2); // bb1[2]: scope 0 at $DIR/repeat.rs:6:31: 6:32
|
||||
StorageDead(_4); // bb1[3]: scope 0 at $DIR/repeat.rs:6:32: 6:33
|
||||
StorageDead(_3); // bb1[4]: scope 0 at $DIR/repeat.rs:6:32: 6:33
|
||||
_0 = (); // bb1[5]: scope 0 at $DIR/repeat.rs:5:11: 7:2
|
||||
StorageDead(_1); // bb1[6]: scope 0 at $DIR/repeat.rs:7:1: 7:2
|
||||
return; // bb1[7]: scope 0 at $DIR/repeat.rs:7:2: 7:2
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
// compile-flags: -C overflow-checks=on
|
||||
|
||||
// EMIT_MIR rustc.add.ConstProp.diff
|
||||
// EMIT_MIR rustc.add.PreCodegen.before.mir
|
||||
fn add() -> u32 {
|
||||
2 + 2
|
||||
}
|
||||
|
@ -7,42 +9,3 @@ fn add() -> u32 {
|
|||
fn main() {
|
||||
add();
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
// START rustc.add.ConstProp.before.mir
|
||||
// fn add() -> u32 {
|
||||
// let mut _0: u32;
|
||||
// let mut _1: (u32, bool);
|
||||
// bb0: {
|
||||
// _1 = CheckedAdd(const 2u32, const 2u32);
|
||||
// assert(!move (_1.1: bool), "attempt to add with overflow") -> bb1;
|
||||
// }
|
||||
// bb1: {
|
||||
// _0 = move (_1.0: u32);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// END rustc.add.ConstProp.before.mir
|
||||
// START rustc.add.ConstProp.after.mir
|
||||
// fn add() -> u32 {
|
||||
// let mut _0: u32;
|
||||
// let mut _1: (u32, bool);
|
||||
// bb0: {
|
||||
// _1 = (const 4u32, const false);
|
||||
// assert(!const false, "attempt to add with overflow") -> bb1;
|
||||
// }
|
||||
// bb1: {
|
||||
// _0 = const 4u32;
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// END rustc.add.ConstProp.after.mir
|
||||
// START rustc.add.PreCodegen.before.mir
|
||||
// fn add() -> u32 {
|
||||
// let mut _0: u32;
|
||||
// bb0: {
|
||||
// _0 = const 4u32;
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// END rustc.add.PreCodegen.before.mir
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
- // MIR for `add` before ConstProp
|
||||
+ // MIR for `add` after ConstProp
|
||||
|
||||
fn add() -> u32 {
|
||||
let mut _0: u32; // return place in scope 0 at $DIR/return_place.rs:5:13: 5:16
|
||||
let mut _1: (u32, bool); // in scope 0 at $DIR/return_place.rs:6:5: 6:10
|
||||
|
||||
bb0: {
|
||||
- _1 = CheckedAdd(const 2u32, const 2u32); // bb0[0]: scope 0 at $DIR/return_place.rs:6:5: 6:10
|
||||
+ _1 = (const 4u32, const false); // bb0[0]: scope 0 at $DIR/return_place.rs:6:5: 6:10
|
||||
// ty::Const
|
||||
// + ty: u32
|
||||
- // + val: Value(Scalar(0x00000002))
|
||||
+ // + val: Value(Scalar(0x00000004))
|
||||
// mir::Constant
|
||||
- // + span: $DIR/return_place.rs:6:5: 6:6
|
||||
- // + literal: Const { ty: u32, val: Value(Scalar(0x00000002)) }
|
||||
+ // + span: $DIR/return_place.rs:6:5: 6:10
|
||||
+ // + literal: Const { ty: u32, val: Value(Scalar(0x00000004)) }
|
||||
// ty::Const
|
||||
- // + ty: u32
|
||||
- // + val: Value(Scalar(0x00000002))
|
||||
+ // + ty: bool
|
||||
+ // + val: Value(Scalar(0x00))
|
||||
// mir::Constant
|
||||
- // + span: $DIR/return_place.rs:6:9: 6:10
|
||||
- // + literal: Const { ty: u32, val: Value(Scalar(0x00000002)) }
|
||||
- assert(!move (_1.1: bool), "attempt to add with overflow") -> bb1; // bb0[1]: scope 0 at $DIR/return_place.rs:6:5: 6:10
|
||||
+ // + span: $DIR/return_place.rs:6:5: 6:10
|
||||
+ // + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
|
||||
+ assert(!const false, "attempt to add with overflow") -> bb1; // bb0[1]: scope 0 at $DIR/return_place.rs:6:5: 6:10
|
||||
+ // ty::Const
|
||||
+ // + ty: bool
|
||||
+ // + val: Value(Scalar(0x00))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/return_place.rs:6:5: 6:10
|
||||
+ // + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
- _0 = move (_1.0: u32); // bb1[0]: scope 0 at $DIR/return_place.rs:6:5: 6:10
|
||||
+ _0 = const 4u32; // bb1[0]: scope 0 at $DIR/return_place.rs:6:5: 6:10
|
||||
+ // ty::Const
|
||||
+ // + ty: u32
|
||||
+ // + val: Value(Scalar(0x00000004))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/return_place.rs:6:5: 6:10
|
||||
+ // + literal: Const { ty: u32, val: Value(Scalar(0x00000004)) }
|
||||
return; // bb1[1]: scope 0 at $DIR/return_place.rs:7:2: 7:2
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
// MIR for `add` before PreCodegen
|
||||
|
||||
fn add() -> u32 {
|
||||
let mut _0: u32; // return place in scope 0 at $DIR/return_place.rs:5:13: 5:16
|
||||
|
||||
bb0: {
|
||||
_0 = const 4u32; // bb0[0]: scope 0 at $DIR/return_place.rs:6:5: 6:10
|
||||
// ty::Const
|
||||
// + ty: u32
|
||||
// + val: Value(Scalar(0x00000004))
|
||||
// mir::Constant
|
||||
// + span: $DIR/return_place.rs:6:5: 6:10
|
||||
// + literal: Const { ty: u32, val: Value(Scalar(0x00000004)) }
|
||||
return; // bb0[1]: scope 0 at $DIR/return_place.rs:7:2: 7:2
|
||||
}
|
||||
}
|
|
@ -1,43 +1,6 @@
|
|||
// EMIT_MIR_FOR_EACH_BIT_WIDTH
|
||||
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
fn main() {
|
||||
(&[1u32, 2, 3] as &[u32])[1];
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
// START rustc.main.ConstProp.before.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _9 = const main::promoted[0];
|
||||
// _4 = _9;
|
||||
// _3 = _4;
|
||||
// _2 = move _3 as &[u32] (Pointer(Unsize));
|
||||
// ...
|
||||
// _6 = const 1usize;
|
||||
// _7 = Len((*_2));
|
||||
// _8 = Lt(_6, _7);
|
||||
// assert(move _8, "index out of bounds: the len is move _7 but the index is _6") -> bb1;
|
||||
// }
|
||||
// bb1: {
|
||||
// _1 = (*_2)[_6];
|
||||
// ...
|
||||
// return;
|
||||
// }
|
||||
// END rustc.main.ConstProp.before.mir
|
||||
// START rustc.main.ConstProp.after.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _9 = const main::promoted[0];
|
||||
// _4 = _9;
|
||||
// _3 = _4;
|
||||
// _2 = move _3 as &[u32] (Pointer(Unsize));
|
||||
// ...
|
||||
// _6 = const 1usize;
|
||||
// _7 = const 3usize;
|
||||
// _8 = const true;
|
||||
// assert(const true, "index out of bounds: the len is move _7 but the index is _6") -> bb1;
|
||||
// }
|
||||
// bb1: {
|
||||
// _1 = const 2u32;
|
||||
// ...
|
||||
// return;
|
||||
// }
|
||||
// END rustc.main.ConstProp.after.mir
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/slice_len.rs:4:11: 4:11
|
||||
let _1: u32; // in scope 0 at $DIR/slice_len.rs:5:5: 5:33
|
||||
let mut _2: &[u32]; // in scope 0 at $DIR/slice_len.rs:5:5: 5:30
|
||||
let mut _3: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:5:6: 5:19
|
||||
let _4: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:5:6: 5:19
|
||||
let _5: [u32; 3]; // in scope 0 at $DIR/slice_len.rs:5:7: 5:19
|
||||
let _6: usize; // in scope 0 at $DIR/slice_len.rs:5:31: 5:32
|
||||
let mut _7: usize; // in scope 0 at $DIR/slice_len.rs:5:5: 5:33
|
||||
let mut _8: bool; // in scope 0 at $DIR/slice_len.rs:5:5: 5:33
|
||||
let mut _9: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:5:6: 5:19
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/slice_len.rs:5:5: 5:33
|
||||
StorageLive(_2); // bb0[1]: scope 0 at $DIR/slice_len.rs:5:5: 5:30
|
||||
StorageLive(_3); // bb0[2]: scope 0 at $DIR/slice_len.rs:5:6: 5:19
|
||||
StorageLive(_4); // bb0[3]: scope 0 at $DIR/slice_len.rs:5:6: 5:19
|
||||
_9 = const main::promoted[0]; // bb0[4]: scope 0 at $DIR/slice_len.rs:5:6: 5:19
|
||||
// ty::Const
|
||||
// + ty: &[u32; 3]
|
||||
// + val: Unevaluated(DefId(0:3 ~ slice_len[317d]::main[0]), [], Some(promoted[0]))
|
||||
// mir::Constant
|
||||
// + span: $DIR/slice_len.rs:5:6: 5:19
|
||||
// + literal: Const { ty: &[u32; 3], val: Unevaluated(DefId(0:3 ~ slice_len[317d]::main[0]), [], Some(promoted[0])) }
|
||||
_4 = _9; // bb0[5]: scope 0 at $DIR/slice_len.rs:5:6: 5:19
|
||||
_3 = _4; // bb0[6]: scope 0 at $DIR/slice_len.rs:5:6: 5:19
|
||||
_2 = move _3 as &[u32] (Pointer(Unsize)); // bb0[7]: scope 0 at $DIR/slice_len.rs:5:6: 5:19
|
||||
StorageDead(_3); // bb0[8]: scope 0 at $DIR/slice_len.rs:5:18: 5:19
|
||||
StorageLive(_6); // bb0[9]: scope 0 at $DIR/slice_len.rs:5:31: 5:32
|
||||
_6 = const 1usize; // bb0[10]: scope 0 at $DIR/slice_len.rs:5:31: 5:32
|
||||
// ty::Const
|
||||
// + ty: usize
|
||||
// + val: Value(Scalar(0x00000001))
|
||||
// mir::Constant
|
||||
// + span: $DIR/slice_len.rs:5:31: 5:32
|
||||
// + literal: Const { ty: usize, val: Value(Scalar(0x00000001)) }
|
||||
- _7 = Len((*_2)); // bb0[11]: scope 0 at $DIR/slice_len.rs:5:5: 5:33
|
||||
- _8 = Lt(_6, _7); // bb0[12]: scope 0 at $DIR/slice_len.rs:5:5: 5:33
|
||||
- assert(move _8, "index out of bounds: the len is move _7 but the index is _6") -> bb1; // bb0[13]: scope 0 at $DIR/slice_len.rs:5:5: 5:33
|
||||
+ _7 = const 3usize; // bb0[11]: scope 0 at $DIR/slice_len.rs:5:5: 5:33
|
||||
+ // ty::Const
|
||||
+ // + ty: usize
|
||||
+ // + val: Value(Scalar(0x00000003))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/slice_len.rs:5:5: 5:33
|
||||
+ // + literal: Const { ty: usize, val: Value(Scalar(0x00000003)) }
|
||||
+ _8 = const true; // bb0[12]: scope 0 at $DIR/slice_len.rs:5:5: 5:33
|
||||
+ // ty::Const
|
||||
+ // + ty: bool
|
||||
+ // + val: Value(Scalar(0x01))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/slice_len.rs:5:5: 5:33
|
||||
+ // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
|
||||
+ assert(const true, "index out of bounds: the len is move _7 but the index is _6") -> bb1; // bb0[13]: scope 0 at $DIR/slice_len.rs:5:5: 5:33
|
||||
+ // ty::Const
|
||||
+ // + ty: bool
|
||||
+ // + val: Value(Scalar(0x01))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/slice_len.rs:5:5: 5:33
|
||||
+ // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
- _1 = (*_2)[_6]; // bb1[0]: scope 0 at $DIR/slice_len.rs:5:5: 5:33
|
||||
+ _1 = const 2u32; // bb1[0]: scope 0 at $DIR/slice_len.rs:5:5: 5:33
|
||||
+ // ty::Const
|
||||
+ // + ty: u32
|
||||
+ // + val: Value(Scalar(0x00000002))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/slice_len.rs:5:5: 5:33
|
||||
+ // + literal: Const { ty: u32, val: Value(Scalar(0x00000002)) }
|
||||
StorageDead(_6); // bb1[1]: scope 0 at $DIR/slice_len.rs:5:33: 5:34
|
||||
StorageDead(_4); // bb1[2]: scope 0 at $DIR/slice_len.rs:5:33: 5:34
|
||||
StorageDead(_2); // bb1[3]: scope 0 at $DIR/slice_len.rs:5:33: 5:34
|
||||
StorageDead(_1); // bb1[4]: scope 0 at $DIR/slice_len.rs:5:33: 5:34
|
||||
_0 = (); // bb1[5]: scope 0 at $DIR/slice_len.rs:4:11: 6:2
|
||||
return; // bb1[6]: scope 0 at $DIR/slice_len.rs:6:2: 6:2
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/slice_len.rs:4:11: 4:11
|
||||
let _1: u32; // in scope 0 at $DIR/slice_len.rs:5:5: 5:33
|
||||
let mut _2: &[u32]; // in scope 0 at $DIR/slice_len.rs:5:5: 5:30
|
||||
let mut _3: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:5:6: 5:19
|
||||
let _4: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:5:6: 5:19
|
||||
let _5: [u32; 3]; // in scope 0 at $DIR/slice_len.rs:5:7: 5:19
|
||||
let _6: usize; // in scope 0 at $DIR/slice_len.rs:5:31: 5:32
|
||||
let mut _7: usize; // in scope 0 at $DIR/slice_len.rs:5:5: 5:33
|
||||
let mut _8: bool; // in scope 0 at $DIR/slice_len.rs:5:5: 5:33
|
||||
let mut _9: &[u32; 3]; // in scope 0 at $DIR/slice_len.rs:5:6: 5:19
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/slice_len.rs:5:5: 5:33
|
||||
StorageLive(_2); // bb0[1]: scope 0 at $DIR/slice_len.rs:5:5: 5:30
|
||||
StorageLive(_3); // bb0[2]: scope 0 at $DIR/slice_len.rs:5:6: 5:19
|
||||
StorageLive(_4); // bb0[3]: scope 0 at $DIR/slice_len.rs:5:6: 5:19
|
||||
_9 = const main::promoted[0]; // bb0[4]: scope 0 at $DIR/slice_len.rs:5:6: 5:19
|
||||
// ty::Const
|
||||
// + ty: &[u32; 3]
|
||||
// + val: Unevaluated(DefId(0:3 ~ slice_len[317d]::main[0]), [], Some(promoted[0]))
|
||||
// mir::Constant
|
||||
// + span: $DIR/slice_len.rs:5:6: 5:19
|
||||
// + literal: Const { ty: &[u32; 3], val: Unevaluated(DefId(0:3 ~ slice_len[317d]::main[0]), [], Some(promoted[0])) }
|
||||
_4 = _9; // bb0[5]: scope 0 at $DIR/slice_len.rs:5:6: 5:19
|
||||
_3 = _4; // bb0[6]: scope 0 at $DIR/slice_len.rs:5:6: 5:19
|
||||
_2 = move _3 as &[u32] (Pointer(Unsize)); // bb0[7]: scope 0 at $DIR/slice_len.rs:5:6: 5:19
|
||||
StorageDead(_3); // bb0[8]: scope 0 at $DIR/slice_len.rs:5:18: 5:19
|
||||
StorageLive(_6); // bb0[9]: scope 0 at $DIR/slice_len.rs:5:31: 5:32
|
||||
_6 = const 1usize; // bb0[10]: scope 0 at $DIR/slice_len.rs:5:31: 5:32
|
||||
// ty::Const
|
||||
// + ty: usize
|
||||
// + val: Value(Scalar(0x0000000000000001))
|
||||
// mir::Constant
|
||||
// + span: $DIR/slice_len.rs:5:31: 5:32
|
||||
// + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000001)) }
|
||||
- _7 = Len((*_2)); // bb0[11]: scope 0 at $DIR/slice_len.rs:5:5: 5:33
|
||||
- _8 = Lt(_6, _7); // bb0[12]: scope 0 at $DIR/slice_len.rs:5:5: 5:33
|
||||
- assert(move _8, "index out of bounds: the len is move _7 but the index is _6") -> bb1; // bb0[13]: scope 0 at $DIR/slice_len.rs:5:5: 5:33
|
||||
+ _7 = const 3usize; // bb0[11]: scope 0 at $DIR/slice_len.rs:5:5: 5:33
|
||||
+ // ty::Const
|
||||
+ // + ty: usize
|
||||
+ // + val: Value(Scalar(0x0000000000000003))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/slice_len.rs:5:5: 5:33
|
||||
+ // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000003)) }
|
||||
+ _8 = const true; // bb0[12]: scope 0 at $DIR/slice_len.rs:5:5: 5:33
|
||||
+ // ty::Const
|
||||
+ // + ty: bool
|
||||
+ // + val: Value(Scalar(0x01))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/slice_len.rs:5:5: 5:33
|
||||
+ // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
|
||||
+ assert(const true, "index out of bounds: the len is move _7 but the index is _6") -> bb1; // bb0[13]: scope 0 at $DIR/slice_len.rs:5:5: 5:33
|
||||
+ // ty::Const
|
||||
+ // + ty: bool
|
||||
+ // + val: Value(Scalar(0x01))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/slice_len.rs:5:5: 5:33
|
||||
+ // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
- _1 = (*_2)[_6]; // bb1[0]: scope 0 at $DIR/slice_len.rs:5:5: 5:33
|
||||
+ _1 = const 2u32; // bb1[0]: scope 0 at $DIR/slice_len.rs:5:5: 5:33
|
||||
+ // ty::Const
|
||||
+ // + ty: u32
|
||||
+ // + val: Value(Scalar(0x00000002))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/slice_len.rs:5:5: 5:33
|
||||
+ // + literal: Const { ty: u32, val: Value(Scalar(0x00000002)) }
|
||||
StorageDead(_6); // bb1[1]: scope 0 at $DIR/slice_len.rs:5:33: 5:34
|
||||
StorageDead(_4); // bb1[2]: scope 0 at $DIR/slice_len.rs:5:33: 5:34
|
||||
StorageDead(_2); // bb1[3]: scope 0 at $DIR/slice_len.rs:5:33: 5:34
|
||||
StorageDead(_1); // bb1[4]: scope 0 at $DIR/slice_len.rs:5:33: 5:34
|
||||
_0 = (); // bb1[5]: scope 0 at $DIR/slice_len.rs:4:11: 6:2
|
||||
return; // bb1[6]: scope 0 at $DIR/slice_len.rs:6:2: 6:2
|
||||
}
|
||||
}
|
||||
|
|
@ -1,38 +1,11 @@
|
|||
#[inline(never)]
|
||||
fn foo(_: i32) { }
|
||||
|
||||
// EMIT_MIR rustc.main.ConstProp.diff
|
||||
// EMIT_MIR rustc.main.SimplifyBranches-after-const-prop.diff
|
||||
fn main() {
|
||||
match 1 {
|
||||
1 => foo(0),
|
||||
_ => foo(-1),
|
||||
}
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
// START rustc.main.ConstProp.before.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _1 = const 1i32;
|
||||
// switchInt(_1) -> [1i32: bb2, otherwise: bb1];
|
||||
// }
|
||||
// END rustc.main.ConstProp.before.mir
|
||||
// START rustc.main.ConstProp.after.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// switchInt(const 1i32) -> [1i32: bb2, otherwise: bb1];
|
||||
// }
|
||||
// END rustc.main.ConstProp.after.mir
|
||||
// START rustc.main.SimplifyBranches-after-const-prop.before.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _1 = const 1i32;
|
||||
// switchInt(const 1i32) -> [1i32: bb2, otherwise: bb1];
|
||||
// }
|
||||
// END rustc.main.SimplifyBranches-after-const-prop.before.mir
|
||||
// START rustc.main.SimplifyBranches-after-const-prop.after.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _1 = const 1i32;
|
||||
// goto -> bb2;
|
||||
// }
|
||||
// END rustc.main.SimplifyBranches-after-const-prop.after.mir
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
- // MIR for `main` before ConstProp
|
||||
+ // MIR for `main` after ConstProp
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/switch_int.rs:6:11: 6:11
|
||||
let mut _1: i32; // in scope 0 at $DIR/switch_int.rs:7:11: 7:12
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/switch_int.rs:7:11: 7:12
|
||||
_1 = const 1i32; // bb0[1]: scope 0 at $DIR/switch_int.rs:7:11: 7:12
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000001))
|
||||
// mir::Constant
|
||||
// + span: $DIR/switch_int.rs:7:11: 7:12
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) }
|
||||
- switchInt(_1) -> [1i32: bb2, otherwise: bb1]; // bb0[2]: scope 0 at $DIR/switch_int.rs:8:9: 8:10
|
||||
+ switchInt(const 1i32) -> [1i32: bb2, otherwise: bb1]; // bb0[2]: scope 0 at $DIR/switch_int.rs:8:9: 8:10
|
||||
+ // ty::Const
|
||||
+ // + ty: i32
|
||||
+ // + val: Value(Scalar(0x00000001))
|
||||
+ // mir::Constant
|
||||
+ // + span: $DIR/switch_int.rs:8:9: 8:10
|
||||
+ // + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
_0 = const foo(const -1i32) -> bb3; // bb1[0]: scope 0 at $DIR/switch_int.rs:9:14: 9:21
|
||||
// ty::Const
|
||||
// + ty: fn(i32) {foo}
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $DIR/switch_int.rs:9:14: 9:17
|
||||
// + literal: Const { ty: fn(i32) {foo}, val: Value(Scalar(<ZST>)) }
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0xffffffff))
|
||||
// mir::Constant
|
||||
// + span: $DIR/switch_int.rs:9:18: 9:20
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0xffffffff)) }
|
||||
}
|
||||
|
||||
bb2: {
|
||||
_0 = const foo(const 0i32) -> bb3; // bb2[0]: scope 0 at $DIR/switch_int.rs:8:14: 8:20
|
||||
// ty::Const
|
||||
// + ty: fn(i32) {foo}
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $DIR/switch_int.rs:8:14: 8:17
|
||||
// + literal: Const { ty: fn(i32) {foo}, val: Value(Scalar(<ZST>)) }
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000000))
|
||||
// mir::Constant
|
||||
// + span: $DIR/switch_int.rs:8:18: 8:19
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000000)) }
|
||||
}
|
||||
|
||||
bb3: {
|
||||
StorageDead(_1); // bb3[0]: scope 0 at $DIR/switch_int.rs:11:1: 11:2
|
||||
return; // bb3[1]: scope 0 at $DIR/switch_int.rs:11:2: 11:2
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
- // MIR for `main` before SimplifyBranches-after-const-prop
|
||||
+ // MIR for `main` after SimplifyBranches-after-const-prop
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/switch_int.rs:6:11: 6:11
|
||||
let mut _1: i32; // in scope 0 at $DIR/switch_int.rs:7:11: 7:12
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/switch_int.rs:7:11: 7:12
|
||||
_1 = const 1i32; // bb0[1]: scope 0 at $DIR/switch_int.rs:7:11: 7:12
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000001))
|
||||
// mir::Constant
|
||||
// + span: $DIR/switch_int.rs:7:11: 7:12
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) }
|
||||
- switchInt(const 1i32) -> [1i32: bb2, otherwise: bb1]; // bb0[2]: scope 0 at $DIR/switch_int.rs:8:9: 8:10
|
||||
- // ty::Const
|
||||
- // + ty: i32
|
||||
- // + val: Value(Scalar(0x00000001))
|
||||
- // mir::Constant
|
||||
- // + span: $DIR/switch_int.rs:8:9: 8:10
|
||||
- // + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) }
|
||||
+ goto -> bb2; // bb0[2]: scope 0 at $DIR/switch_int.rs:8:9: 8:10
|
||||
}
|
||||
|
||||
bb1: {
|
||||
_0 = const foo(const -1i32) -> bb3; // bb1[0]: scope 0 at $DIR/switch_int.rs:9:14: 9:21
|
||||
// ty::Const
|
||||
// + ty: fn(i32) {foo}
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $DIR/switch_int.rs:9:14: 9:17
|
||||
// + literal: Const { ty: fn(i32) {foo}, val: Value(Scalar(<ZST>)) }
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0xffffffff))
|
||||
// mir::Constant
|
||||
// + span: $DIR/switch_int.rs:9:18: 9:20
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0xffffffff)) }
|
||||
}
|
||||
|
||||
bb2: {
|
||||
_0 = const foo(const 0i32) -> bb3; // bb2[0]: scope 0 at $DIR/switch_int.rs:8:14: 8:20
|
||||
// ty::Const
|
||||
// + ty: fn(i32) {foo}
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $DIR/switch_int.rs:8:14: 8:17
|
||||
// + literal: Const { ty: fn(i32) {foo}, val: Value(Scalar(<ZST>)) }
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000000))
|
||||
// mir::Constant
|
||||
// + span: $DIR/switch_int.rs:8:18: 8:19
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000000)) }
|
||||
}
|
||||
|
||||
bb3: {
|
||||
StorageDead(_1); // bb3[0]: scope 0 at $DIR/switch_int.rs:11:1: 11:2
|
||||
return; // bb3[1]: scope 0 at $DIR/switch_int.rs:11:2: 11:2
|
||||
}
|
||||
}
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
// EMIT_MIR rustc.test.CopyPropagation.diff
|
||||
|
||||
fn test(x: u32) -> u32 {
|
||||
let y = x;
|
||||
y
|
||||
|
@ -7,23 +9,3 @@ fn main() {
|
|||
// Make sure the function actually gets instantiated.
|
||||
test(0);
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
// START rustc.test.CopyPropagation.before.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _2 = _1;
|
||||
// ...
|
||||
// _0 = _2;
|
||||
// ...
|
||||
// return;
|
||||
// }
|
||||
// END rustc.test.CopyPropagation.before.mir
|
||||
// START rustc.test.CopyPropagation.after.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _0 = _1;
|
||||
// ...
|
||||
// return;
|
||||
// }
|
||||
// END rustc.test.CopyPropagation.after.mir
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
- // MIR for `test` before CopyPropagation
|
||||
+ // MIR for `test` after CopyPropagation
|
||||
|
||||
fn test(_1: u32) -> u32 {
|
||||
debug x => _1; // in scope 0 at $DIR/copy_propagation.rs:3:9: 3:10
|
||||
let mut _0: u32; // return place in scope 0 at $DIR/copy_propagation.rs:3:20: 3:23
|
||||
let _2: u32; // in scope 0 at $DIR/copy_propagation.rs:4:9: 4:10
|
||||
scope 1 {
|
||||
- debug y => _2; // in scope 1 at $DIR/copy_propagation.rs:4:9: 4:10
|
||||
+ debug y => _1; // in scope 1 at $DIR/copy_propagation.rs:4:9: 4:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
- StorageLive(_2); // bb0[0]: scope 0 at $DIR/copy_propagation.rs:4:9: 4:10
|
||||
- _2 = _1; // bb0[1]: scope 0 at $DIR/copy_propagation.rs:4:13: 4:14
|
||||
- _0 = _2; // bb0[2]: scope 1 at $DIR/copy_propagation.rs:5:5: 5:6
|
||||
- StorageDead(_2); // bb0[3]: scope 0 at $DIR/copy_propagation.rs:6:1: 6:2
|
||||
+ nop; // bb0[0]: scope 0 at $DIR/copy_propagation.rs:4:9: 4:10
|
||||
+ nop; // bb0[1]: scope 0 at $DIR/copy_propagation.rs:4:13: 4:14
|
||||
+ _0 = _1; // bb0[2]: scope 1 at $DIR/copy_propagation.rs:5:5: 5:6
|
||||
+ nop; // bb0[3]: scope 0 at $DIR/copy_propagation.rs:6:1: 6:2
|
||||
return; // bb0[4]: scope 0 at $DIR/copy_propagation.rs:6:2: 6:2
|
||||
}
|
||||
}
|
||||
|
|
@ -5,21 +5,25 @@ fn dummy(x: u8) -> u8 {
|
|||
x
|
||||
}
|
||||
|
||||
// EMIT_MIR rustc.foo.CopyPropagation.diff
|
||||
fn foo(mut x: u8) {
|
||||
// calling `dummy` to make an use of `x` that copyprop cannot eliminate
|
||||
x = dummy(x); // this will assign a local to `x`
|
||||
}
|
||||
|
||||
// EMIT_MIR rustc.bar.CopyPropagation.diff
|
||||
fn bar(mut x: u8) {
|
||||
dummy(x);
|
||||
x = 5;
|
||||
}
|
||||
|
||||
// EMIT_MIR rustc.baz.CopyPropagation.diff
|
||||
fn baz(mut x: i32) {
|
||||
// self-assignment to a function argument should be eliminated
|
||||
x = x;
|
||||
}
|
||||
|
||||
// EMIT_MIR rustc.arg_src.CopyPropagation.diff
|
||||
fn arg_src(mut x: i32) -> i32 {
|
||||
let y = x;
|
||||
x = 123; // Don't propagate this assignment to `y`
|
||||
|
@ -33,100 +37,3 @@ fn main() {
|
|||
baz(0);
|
||||
arg_src(0);
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
// START rustc.foo.CopyPropagation.before.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _3 = _1;
|
||||
// _2 = const dummy(move _3) -> bb1;
|
||||
// }
|
||||
// bb1: {
|
||||
// ...
|
||||
// _1 = move _2;
|
||||
// ...
|
||||
// }
|
||||
// END rustc.foo.CopyPropagation.before.mir
|
||||
// START rustc.foo.CopyPropagation.after.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _3 = _1;
|
||||
// _2 = const dummy(move _3) -> bb1;
|
||||
// }
|
||||
// bb1: {
|
||||
// ...
|
||||
// _1 = move _2;
|
||||
// ...
|
||||
// }
|
||||
// END rustc.foo.CopyPropagation.after.mir
|
||||
// START rustc.bar.CopyPropagation.before.mir
|
||||
// bb0: {
|
||||
// StorageLive(_2);
|
||||
// StorageLive(_3);
|
||||
// _3 = _1;
|
||||
// _2 = const dummy(move _3) -> bb1;
|
||||
// }
|
||||
// bb1: {
|
||||
// StorageDead(_3);
|
||||
// StorageDead(_2);
|
||||
// _1 = const 5u8;
|
||||
// ...
|
||||
// return;
|
||||
// }
|
||||
// END rustc.bar.CopyPropagation.before.mir
|
||||
// START rustc.bar.CopyPropagation.after.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _3 = _1;
|
||||
// _2 = const dummy(move _3) -> bb1;
|
||||
// }
|
||||
// bb1: {
|
||||
// ...
|
||||
// _1 = const 5u8;
|
||||
// ...
|
||||
// return;
|
||||
// }
|
||||
// END rustc.bar.CopyPropagation.after.mir
|
||||
// START rustc.baz.CopyPropagation.before.mir
|
||||
// bb0: {
|
||||
// StorageLive(_2);
|
||||
// _2 = _1;
|
||||
// _1 = move _2;
|
||||
// StorageDead(_2);
|
||||
// ...
|
||||
// return;
|
||||
// }
|
||||
// END rustc.baz.CopyPropagation.before.mir
|
||||
// START rustc.baz.CopyPropagation.after.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _2 = _1;
|
||||
// _1 = move _2;
|
||||
// ...
|
||||
// return;
|
||||
// }
|
||||
// END rustc.baz.CopyPropagation.after.mir
|
||||
// START rustc.arg_src.CopyPropagation.before.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _2 = _1;
|
||||
// ...
|
||||
// _1 = const 123i32;
|
||||
// ...
|
||||
// _0 = _2;
|
||||
// ...
|
||||
// return;
|
||||
// }
|
||||
// END rustc.arg_src.CopyPropagation.before.mir
|
||||
// START rustc.arg_src.CopyPropagation.after.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _2 = _1;
|
||||
// ...
|
||||
// _1 = const 123i32;
|
||||
// ...
|
||||
// _0 = _2;
|
||||
// ...
|
||||
// return;
|
||||
// }
|
||||
// END rustc.arg_src.CopyPropagation.after.mir
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
- // MIR for `arg_src` before CopyPropagation
|
||||
+ // MIR for `arg_src` after CopyPropagation
|
||||
|
||||
fn arg_src(_1: i32) -> i32 {
|
||||
debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:27:12: 27:17
|
||||
let mut _0: i32; // return place in scope 0 at $DIR/copy_propagation_arg.rs:27:27: 27:30
|
||||
let _2: i32; // in scope 0 at $DIR/copy_propagation_arg.rs:28:9: 28:10
|
||||
scope 1 {
|
||||
debug y => _2; // in scope 1 at $DIR/copy_propagation_arg.rs:28:9: 28:10
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_2); // bb0[0]: scope 0 at $DIR/copy_propagation_arg.rs:28:9: 28:10
|
||||
_2 = _1; // bb0[1]: scope 0 at $DIR/copy_propagation_arg.rs:28:13: 28:14
|
||||
_1 = const 123i32; // bb0[2]: scope 1 at $DIR/copy_propagation_arg.rs:29:5: 29:12
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x0000007b))
|
||||
// mir::Constant
|
||||
// + span: $DIR/copy_propagation_arg.rs:29:5: 29:12
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x0000007b)) }
|
||||
_0 = _2; // bb0[3]: scope 1 at $DIR/copy_propagation_arg.rs:30:5: 30:6
|
||||
StorageDead(_2); // bb0[4]: scope 0 at $DIR/copy_propagation_arg.rs:31:1: 31:2
|
||||
return; // bb0[5]: scope 0 at $DIR/copy_propagation_arg.rs:31:2: 31:2
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
- // MIR for `bar` before CopyPropagation
|
||||
+ // MIR for `bar` after CopyPropagation
|
||||
|
||||
fn bar(_1: u8) -> () {
|
||||
debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:15:8: 15:13
|
||||
let mut _0: (); // return place in scope 0 at $DIR/copy_propagation_arg.rs:15:19: 15:19
|
||||
let _2: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:16:5: 16:13
|
||||
let mut _3: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:16:11: 16:12
|
||||
|
||||
bb0: {
|
||||
StorageLive(_2); // bb0[0]: scope 0 at $DIR/copy_propagation_arg.rs:16:5: 16:13
|
||||
StorageLive(_3); // bb0[1]: scope 0 at $DIR/copy_propagation_arg.rs:16:11: 16:12
|
||||
_3 = _1; // bb0[2]: scope 0 at $DIR/copy_propagation_arg.rs:16:11: 16:12
|
||||
_2 = const dummy(move _3) -> bb1; // bb0[3]: scope 0 at $DIR/copy_propagation_arg.rs:16:5: 16:13
|
||||
// ty::Const
|
||||
// + ty: fn(u8) -> u8 {dummy}
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $DIR/copy_propagation_arg.rs:16:5: 16:10
|
||||
// + literal: Const { ty: fn(u8) -> u8 {dummy}, val: Value(Scalar(<ZST>)) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
StorageDead(_3); // bb1[0]: scope 0 at $DIR/copy_propagation_arg.rs:16:12: 16:13
|
||||
StorageDead(_2); // bb1[1]: scope 0 at $DIR/copy_propagation_arg.rs:16:13: 16:14
|
||||
_1 = const 5u8; // bb1[2]: scope 0 at $DIR/copy_propagation_arg.rs:17:5: 17:10
|
||||
// ty::Const
|
||||
// + ty: u8
|
||||
// + val: Value(Scalar(0x05))
|
||||
// mir::Constant
|
||||
// + span: $DIR/copy_propagation_arg.rs:17:5: 17:10
|
||||
// + literal: Const { ty: u8, val: Value(Scalar(0x05)) }
|
||||
nop; // bb1[3]: scope 0 at $DIR/copy_propagation_arg.rs:15:19: 18:2
|
||||
return; // bb1[4]: scope 0 at $DIR/copy_propagation_arg.rs:18:2: 18:2
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
- // MIR for `baz` before CopyPropagation
|
||||
+ // MIR for `baz` after CopyPropagation
|
||||
|
||||
fn baz(_1: i32) -> () {
|
||||
debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:21:8: 21:13
|
||||
let mut _0: (); // return place in scope 0 at $DIR/copy_propagation_arg.rs:21:20: 21:20
|
||||
let mut _2: i32; // in scope 0 at $DIR/copy_propagation_arg.rs:23:9: 23:10
|
||||
|
||||
bb0: {
|
||||
StorageLive(_2); // bb0[0]: scope 0 at $DIR/copy_propagation_arg.rs:23:9: 23:10
|
||||
_2 = _1; // bb0[1]: scope 0 at $DIR/copy_propagation_arg.rs:23:9: 23:10
|
||||
_1 = move _2; // bb0[2]: scope 0 at $DIR/copy_propagation_arg.rs:23:5: 23:10
|
||||
StorageDead(_2); // bb0[3]: scope 0 at $DIR/copy_propagation_arg.rs:23:9: 23:10
|
||||
nop; // bb0[4]: scope 0 at $DIR/copy_propagation_arg.rs:21:20: 24:2
|
||||
return; // bb0[5]: scope 0 at $DIR/copy_propagation_arg.rs:24:2: 24:2
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
- // MIR for `foo` before CopyPropagation
|
||||
+ // MIR for `foo` after CopyPropagation
|
||||
|
||||
fn foo(_1: u8) -> () {
|
||||
debug x => _1; // in scope 0 at $DIR/copy_propagation_arg.rs:9:8: 9:13
|
||||
let mut _0: (); // return place in scope 0 at $DIR/copy_propagation_arg.rs:9:19: 9:19
|
||||
let mut _2: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:11:9: 11:17
|
||||
let mut _3: u8; // in scope 0 at $DIR/copy_propagation_arg.rs:11:15: 11:16
|
||||
|
||||
bb0: {
|
||||
StorageLive(_2); // bb0[0]: scope 0 at $DIR/copy_propagation_arg.rs:11:9: 11:17
|
||||
StorageLive(_3); // bb0[1]: scope 0 at $DIR/copy_propagation_arg.rs:11:15: 11:16
|
||||
_3 = _1; // bb0[2]: scope 0 at $DIR/copy_propagation_arg.rs:11:15: 11:16
|
||||
_2 = const dummy(move _3) -> bb1; // bb0[3]: scope 0 at $DIR/copy_propagation_arg.rs:11:9: 11:17
|
||||
// ty::Const
|
||||
// + ty: fn(u8) -> u8 {dummy}
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $DIR/copy_propagation_arg.rs:11:9: 11:14
|
||||
// + literal: Const { ty: fn(u8) -> u8 {dummy}, val: Value(Scalar(<ZST>)) }
|
||||
}
|
||||
|
||||
bb1: {
|
||||
StorageDead(_3); // bb1[0]: scope 0 at $DIR/copy_propagation_arg.rs:11:16: 11:17
|
||||
_1 = move _2; // bb1[1]: scope 0 at $DIR/copy_propagation_arg.rs:11:5: 11:17
|
||||
StorageDead(_2); // bb1[2]: scope 0 at $DIR/copy_propagation_arg.rs:11:16: 11:17
|
||||
nop; // bb1[3]: scope 0 at $DIR/copy_propagation_arg.rs:9:19: 12:2
|
||||
return; // bb1[4]: scope 0 at $DIR/copy_propagation_arg.rs:12:2: 12:2
|
||||
}
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ struct Baz {
|
|||
z: bool,
|
||||
}
|
||||
|
||||
// EMIT_MIR rustc.bar.Deaggregator.diff
|
||||
fn bar(a: usize) -> Baz {
|
||||
Baz { x: a, y: 0.0, z: false }
|
||||
}
|
||||
|
@ -12,27 +13,3 @@ fn main() {
|
|||
// Make sure the function actually gets instantiated.
|
||||
bar(0);
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
// START rustc.bar.Deaggregator.before.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _2 = _1;
|
||||
// ...
|
||||
// _0 = Baz { x: move _2, y: const 0f32, z: const false };
|
||||
// ...
|
||||
// return;
|
||||
// }
|
||||
// END rustc.bar.Deaggregator.before.mir
|
||||
// START rustc.bar.Deaggregator.after.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _2 = _1;
|
||||
// ...
|
||||
// (_0.0: usize) = move _2;
|
||||
// (_0.1: f32) = const 0f32;
|
||||
// (_0.2: bool) = const false;
|
||||
// ...
|
||||
// return;
|
||||
// }
|
||||
// END rustc.bar.Deaggregator.after.mir
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
- // MIR for `bar` before Deaggregator
|
||||
+ // MIR for `bar` after Deaggregator
|
||||
|
||||
fn bar(_1: usize) -> Baz {
|
||||
debug a => _1; // in scope 0 at $DIR/deaggregator_test.rs:8:8: 8:9
|
||||
let mut _0: Baz; // return place in scope 0 at $DIR/deaggregator_test.rs:8:21: 8:24
|
||||
let mut _2: usize; // in scope 0 at $DIR/deaggregator_test.rs:9:14: 9:15
|
||||
|
||||
bb0: {
|
||||
StorageLive(_2); // bb0[0]: scope 0 at $DIR/deaggregator_test.rs:9:14: 9:15
|
||||
_2 = _1; // bb0[1]: scope 0 at $DIR/deaggregator_test.rs:9:14: 9:15
|
||||
- _0 = Baz { x: move _2, y: const 0f32, z: const false }; // bb0[2]: scope 0 at $DIR/deaggregator_test.rs:9:5: 9:35
|
||||
+ (_0.0: usize) = move _2; // bb0[2]: scope 0 at $DIR/deaggregator_test.rs:9:5: 9:35
|
||||
+ (_0.1: f32) = const 0f32; // bb0[3]: scope 0 at $DIR/deaggregator_test.rs:9:5: 9:35
|
||||
// ty::Const
|
||||
// + ty: f32
|
||||
// + val: Value(Scalar(0x00000000))
|
||||
// mir::Constant
|
||||
// + span: $DIR/deaggregator_test.rs:9:20: 9:23
|
||||
// + literal: Const { ty: f32, val: Value(Scalar(0x00000000)) }
|
||||
+ (_0.2: bool) = const false; // bb0[4]: scope 0 at $DIR/deaggregator_test.rs:9:5: 9:35
|
||||
// ty::Const
|
||||
// + ty: bool
|
||||
// + val: Value(Scalar(0x00))
|
||||
// mir::Constant
|
||||
// + span: $DIR/deaggregator_test.rs:9:28: 9:33
|
||||
// + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
|
||||
- StorageDead(_2); // bb0[3]: scope 0 at $DIR/deaggregator_test.rs:9:34: 9:35
|
||||
- return; // bb0[4]: scope 0 at $DIR/deaggregator_test.rs:10:2: 10:2
|
||||
+ StorageDead(_2); // bb0[5]: scope 0 at $DIR/deaggregator_test.rs:9:34: 9:35
|
||||
+ return; // bb0[6]: scope 0 at $DIR/deaggregator_test.rs:10:2: 10:2
|
||||
}
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ enum Baz {
|
|||
Foo { x: usize },
|
||||
}
|
||||
|
||||
// EMIT_MIR rustc.bar.Deaggregator.diff
|
||||
fn bar(a: usize) -> Baz {
|
||||
Baz::Foo { x: a }
|
||||
}
|
||||
|
@ -14,24 +15,3 @@ fn main() {
|
|||
Baz::Foo { x } => println!("{}", x),
|
||||
};
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
// START rustc.bar.Deaggregator.before.mir
|
||||
// bb0: {
|
||||
// StorageLive(_2);
|
||||
// _2 = _1;
|
||||
// _0 = Baz::Foo { x: move _2 };
|
||||
// StorageDead(_2);
|
||||
// return;
|
||||
// }
|
||||
// END rustc.bar.Deaggregator.before.mir
|
||||
// START rustc.bar.Deaggregator.after.mir
|
||||
// bb0: {
|
||||
// StorageLive(_2);
|
||||
// _2 = _1;
|
||||
// ((_0 as Foo).0: usize) = move _2;
|
||||
// discriminant(_0) = 1;
|
||||
// StorageDead(_2);
|
||||
// return;
|
||||
// }
|
||||
// END rustc.bar.Deaggregator.after.mir
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
- // MIR for `bar` before Deaggregator
|
||||
+ // MIR for `bar` after Deaggregator
|
||||
|
||||
fn bar(_1: usize) -> Baz {
|
||||
debug a => _1; // in scope 0 at $DIR/deaggregator_test_enum.rs:7:8: 7:9
|
||||
let mut _0: Baz; // return place in scope 0 at $DIR/deaggregator_test_enum.rs:7:21: 7:24
|
||||
let mut _2: usize; // in scope 0 at $DIR/deaggregator_test_enum.rs:8:19: 8:20
|
||||
|
||||
bb0: {
|
||||
StorageLive(_2); // bb0[0]: scope 0 at $DIR/deaggregator_test_enum.rs:8:19: 8:20
|
||||
_2 = _1; // bb0[1]: scope 0 at $DIR/deaggregator_test_enum.rs:8:19: 8:20
|
||||
- _0 = Baz::Foo { x: move _2 }; // bb0[2]: scope 0 at $DIR/deaggregator_test_enum.rs:8:5: 8:22
|
||||
- StorageDead(_2); // bb0[3]: scope 0 at $DIR/deaggregator_test_enum.rs:8:21: 8:22
|
||||
- return; // bb0[4]: scope 0 at $DIR/deaggregator_test_enum.rs:9:2: 9:2
|
||||
+ ((_0 as Foo).0: usize) = move _2; // bb0[2]: scope 0 at $DIR/deaggregator_test_enum.rs:8:5: 8:22
|
||||
+ discriminant(_0) = 1; // bb0[3]: scope 0 at $DIR/deaggregator_test_enum.rs:8:5: 8:22
|
||||
+ StorageDead(_2); // bb0[4]: scope 0 at $DIR/deaggregator_test_enum.rs:8:21: 8:22
|
||||
+ return; // bb0[5]: scope 0 at $DIR/deaggregator_test_enum.rs:9:2: 9:2
|
||||
}
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ enum Foo {
|
|||
B(i32),
|
||||
}
|
||||
|
||||
// EMIT_MIR rustc.test1.Deaggregator.diff
|
||||
fn test1(x: bool, y: i32) -> Foo {
|
||||
if x {
|
||||
Foo::A(y)
|
||||
|
@ -17,40 +18,3 @@ fn main() {
|
|||
// Make sure the function actually gets instantiated.
|
||||
test1(false, 0);
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
// START rustc.test1.Deaggregator.before.mir
|
||||
// bb1: {
|
||||
// StorageLive(_5);
|
||||
// _5 = _2;
|
||||
// _0 = Foo::B(move _5,);
|
||||
// StorageDead(_5);
|
||||
// goto -> bb3;
|
||||
// }
|
||||
// bb2: {
|
||||
// StorageLive(_4);
|
||||
// _4 = _2;
|
||||
// _0 = Foo::A(move _4,);
|
||||
// StorageDead(_4);
|
||||
// goto -> bb3;
|
||||
// }
|
||||
// END rustc.test1.Deaggregator.before.mir
|
||||
// START rustc.test1.Deaggregator.after.mir
|
||||
// bb1: {
|
||||
// StorageLive(_5);
|
||||
// _5 = _2;
|
||||
// ((_0 as B).0: i32) = move _5;
|
||||
// discriminant(_0) = 1;
|
||||
// StorageDead(_5);
|
||||
// goto -> bb3;
|
||||
// }
|
||||
// bb2: {
|
||||
// StorageLive(_4);
|
||||
// _4 = _2;
|
||||
// ((_0 as A).0: i32) = move _4;
|
||||
// discriminant(_0) = 0;
|
||||
// StorageDead(_4);
|
||||
// goto -> bb3;
|
||||
// }
|
||||
// END rustc.test1.Deaggregator.after.mir
|
||||
//
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
- // MIR for `test1` before Deaggregator
|
||||
+ // MIR for `test1` after Deaggregator
|
||||
|
||||
fn test1(_1: bool, _2: i32) -> Foo {
|
||||
debug x => _1; // in scope 0 at $DIR/deaggregator_test_enum_2.rs:9:10: 9:11
|
||||
debug y => _2; // in scope 0 at $DIR/deaggregator_test_enum_2.rs:9:19: 9:20
|
||||
let mut _0: Foo; // return place in scope 0 at $DIR/deaggregator_test_enum_2.rs:9:30: 9:33
|
||||
let mut _3: bool; // in scope 0 at $DIR/deaggregator_test_enum_2.rs:10:8: 10:9
|
||||
let mut _4: i32; // in scope 0 at $DIR/deaggregator_test_enum_2.rs:11:16: 11:17
|
||||
let mut _5: i32; // in scope 0 at $DIR/deaggregator_test_enum_2.rs:13:16: 13:17
|
||||
|
||||
bb0: {
|
||||
StorageLive(_3); // bb0[0]: scope 0 at $DIR/deaggregator_test_enum_2.rs:10:8: 10:9
|
||||
_3 = _1; // bb0[1]: scope 0 at $DIR/deaggregator_test_enum_2.rs:10:8: 10:9
|
||||
switchInt(_3) -> [false: bb1, otherwise: bb2]; // bb0[2]: scope 0 at $DIR/deaggregator_test_enum_2.rs:10:5: 14:6
|
||||
}
|
||||
|
||||
bb1: {
|
||||
StorageLive(_5); // bb1[0]: scope 0 at $DIR/deaggregator_test_enum_2.rs:13:16: 13:17
|
||||
_5 = _2; // bb1[1]: scope 0 at $DIR/deaggregator_test_enum_2.rs:13:16: 13:17
|
||||
- _0 = Foo::B(move _5,); // bb1[2]: scope 0 at $DIR/deaggregator_test_enum_2.rs:13:9: 13:18
|
||||
- StorageDead(_5); // bb1[3]: scope 0 at $DIR/deaggregator_test_enum_2.rs:13:17: 13:18
|
||||
- goto -> bb3; // bb1[4]: scope 0 at $DIR/deaggregator_test_enum_2.rs:10:5: 14:6
|
||||
+ ((_0 as B).0: i32) = move _5; // bb1[2]: scope 0 at $DIR/deaggregator_test_enum_2.rs:13:9: 13:18
|
||||
+ discriminant(_0) = 1; // bb1[3]: scope 0 at $DIR/deaggregator_test_enum_2.rs:13:9: 13:18
|
||||
+ StorageDead(_5); // bb1[4]: scope 0 at $DIR/deaggregator_test_enum_2.rs:13:17: 13:18
|
||||
+ goto -> bb3; // bb1[5]: scope 0 at $DIR/deaggregator_test_enum_2.rs:10:5: 14:6
|
||||
}
|
||||
|
||||
bb2: {
|
||||
StorageLive(_4); // bb2[0]: scope 0 at $DIR/deaggregator_test_enum_2.rs:11:16: 11:17
|
||||
_4 = _2; // bb2[1]: scope 0 at $DIR/deaggregator_test_enum_2.rs:11:16: 11:17
|
||||
- _0 = Foo::A(move _4,); // bb2[2]: scope 0 at $DIR/deaggregator_test_enum_2.rs:11:9: 11:18
|
||||
- StorageDead(_4); // bb2[3]: scope 0 at $DIR/deaggregator_test_enum_2.rs:11:17: 11:18
|
||||
- goto -> bb3; // bb2[4]: scope 0 at $DIR/deaggregator_test_enum_2.rs:10:5: 14:6
|
||||
+ ((_0 as A).0: i32) = move _4; // bb2[2]: scope 0 at $DIR/deaggregator_test_enum_2.rs:11:9: 11:18
|
||||
+ discriminant(_0) = 0; // bb2[3]: scope 0 at $DIR/deaggregator_test_enum_2.rs:11:9: 11:18
|
||||
+ StorageDead(_4); // bb2[4]: scope 0 at $DIR/deaggregator_test_enum_2.rs:11:17: 11:18
|
||||
+ goto -> bb3; // bb2[5]: scope 0 at $DIR/deaggregator_test_enum_2.rs:10:5: 14:6
|
||||
}
|
||||
|
||||
bb3: {
|
||||
StorageDead(_3); // bb3[0]: scope 0 at $DIR/deaggregator_test_enum_2.rs:15:1: 15:2
|
||||
return; // bb3[1]: scope 0 at $DIR/deaggregator_test_enum_2.rs:15:2: 15:2
|
||||
}
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ enum Foo {
|
|||
B,
|
||||
}
|
||||
|
||||
// EMIT_MIR rustc.test.Deaggregator.diff
|
||||
fn test(x: i32) -> [Foo; 2] {
|
||||
[Foo::A(x), Foo::A(x)]
|
||||
}
|
||||
|
@ -13,37 +14,3 @@ fn main() {
|
|||
// Make sure the function actually gets instantiated.
|
||||
test(0);
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
// START rustc.test.Deaggregator.before.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _3 = _1;
|
||||
// ...
|
||||
// _2 = Foo::A(move _3,);
|
||||
// ...
|
||||
// _5 = _1;
|
||||
// _4 = Foo::A(move _5,);
|
||||
// ...
|
||||
// _0 = [move _2, move _4];
|
||||
// ...
|
||||
// return;
|
||||
// }
|
||||
// END rustc.test.Deaggregator.before.mir
|
||||
// START rustc.test.Deaggregator.after.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// _3 = _1;
|
||||
// ...
|
||||
// ((_2 as A).0: i32) = move _3;
|
||||
// discriminant(_2) = 0;
|
||||
// ...
|
||||
// _5 = _1;
|
||||
// ((_4 as A).0: i32) = move _5;
|
||||
// discriminant(_4) = 0;
|
||||
// ...
|
||||
// _0 = [move _2, move _4];
|
||||
// ...
|
||||
// return;
|
||||
// }
|
||||
// END rustc.test.Deaggregator.after.mir
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
- // MIR for `test` before Deaggregator
|
||||
+ // MIR for `test` after Deaggregator
|
||||
|
||||
fn test(_1: i32) -> [Foo; 2] {
|
||||
debug x => _1; // in scope 0 at $DIR/deaggregator_test_multiple.rs:9:9: 9:10
|
||||
let mut _0: [Foo; 2]; // return place in scope 0 at $DIR/deaggregator_test_multiple.rs:9:20: 9:28
|
||||
let mut _2: Foo; // in scope 0 at $DIR/deaggregator_test_multiple.rs:10:6: 10:15
|
||||
let mut _3: i32; // in scope 0 at $DIR/deaggregator_test_multiple.rs:10:13: 10:14
|
||||
let mut _4: Foo; // in scope 0 at $DIR/deaggregator_test_multiple.rs:10:17: 10:26
|
||||
let mut _5: i32; // in scope 0 at $DIR/deaggregator_test_multiple.rs:10:24: 10:25
|
||||
|
||||
bb0: {
|
||||
StorageLive(_2); // bb0[0]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:6: 10:15
|
||||
StorageLive(_3); // bb0[1]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:13: 10:14
|
||||
_3 = _1; // bb0[2]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:13: 10:14
|
||||
- _2 = Foo::A(move _3,); // bb0[3]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:6: 10:15
|
||||
- StorageDead(_3); // bb0[4]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:14: 10:15
|
||||
- StorageLive(_4); // bb0[5]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:17: 10:26
|
||||
- StorageLive(_5); // bb0[6]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:24: 10:25
|
||||
- _5 = _1; // bb0[7]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:24: 10:25
|
||||
- _4 = Foo::A(move _5,); // bb0[8]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:17: 10:26
|
||||
- StorageDead(_5); // bb0[9]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:25: 10:26
|
||||
- _0 = [move _2, move _4]; // bb0[10]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:5: 10:27
|
||||
- StorageDead(_4); // bb0[11]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:26: 10:27
|
||||
- StorageDead(_2); // bb0[12]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:26: 10:27
|
||||
- return; // bb0[13]: scope 0 at $DIR/deaggregator_test_multiple.rs:11:2: 11:2
|
||||
+ ((_2 as A).0: i32) = move _3; // bb0[3]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:6: 10:15
|
||||
+ discriminant(_2) = 0; // bb0[4]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:6: 10:15
|
||||
+ StorageDead(_3); // bb0[5]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:14: 10:15
|
||||
+ StorageLive(_4); // bb0[6]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:17: 10:26
|
||||
+ StorageLive(_5); // bb0[7]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:24: 10:25
|
||||
+ _5 = _1; // bb0[8]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:24: 10:25
|
||||
+ ((_4 as A).0: i32) = move _5; // bb0[9]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:17: 10:26
|
||||
+ discriminant(_4) = 0; // bb0[10]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:17: 10:26
|
||||
+ StorageDead(_5); // bb0[11]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:25: 10:26
|
||||
+ _0 = [move _2, move _4]; // bb0[12]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:5: 10:27
|
||||
+ StorageDead(_4); // bb0[13]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:26: 10:27
|
||||
+ StorageDead(_2); // bb0[14]: scope 0 at $DIR/deaggregator_test_multiple.rs:10:26: 10:27
|
||||
+ return; // bb0[15]: scope 0 at $DIR/deaggregator_test_multiple.rs:11:2: 11:2
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +1,8 @@
|
|||
// Test that simple or-patterns don't get expanded to exponentially large CFGs
|
||||
|
||||
// ignore-tidy-linelength
|
||||
|
||||
#![feature(or_patterns)]
|
||||
|
||||
// EMIT_MIR rustc.match_tuple.SimplifyCfg-initial.after.mir
|
||||
fn match_tuple(x: (u32, bool, Option<i32>, u32)) -> u32 {
|
||||
match x {
|
||||
(y @ (1 | 4), true | false, Some(1 | 8) | None, z @ (6..=9 | 13..=16)) => y ^ z,
|
||||
|
@ -12,65 +11,3 @@ fn match_tuple(x: (u32, bool, Option<i32>, u32)) -> u32 {
|
|||
}
|
||||
|
||||
fn main() {}
|
||||
|
||||
// END RUST SOURCE
|
||||
|
||||
// START rustc.match_tuple.SimplifyCfg-initial.after.mir
|
||||
// scope 1 {
|
||||
// debug y => _7;
|
||||
// debug z => _8;
|
||||
// }
|
||||
// bb0: {
|
||||
// FakeRead(ForMatchedPlace, _1);
|
||||
// switchInt((_1.0: u32)) -> [1u32: bb2, 4u32: bb2, otherwise: bb1];
|
||||
// }
|
||||
// bb1: {
|
||||
// _0 = const 0u32;
|
||||
// goto -> bb10;
|
||||
// }
|
||||
// bb2: {
|
||||
// _2 = discriminant((_1.2: std::option::Option<i32>));
|
||||
// switchInt(move _2) -> [0isize: bb4, 1isize: bb3, otherwise: bb1];
|
||||
// }
|
||||
// bb3: {
|
||||
// switchInt((((_1.2: std::option::Option<i32>) as Some).0: i32)) -> [1i32: bb4, 8i32: bb4, otherwise: bb1];
|
||||
// }
|
||||
// bb4: {
|
||||
// _5 = Le(const 6u32, (_1.3: u32));
|
||||
// switchInt(move _5) -> [false: bb6, otherwise: bb5];
|
||||
// }
|
||||
// bb5: {
|
||||
// _6 = Le((_1.3: u32), const 9u32);
|
||||
// switchInt(move _6) -> [false: bb6, otherwise: bb8];
|
||||
// }
|
||||
// bb6: {
|
||||
// _3 = Le(const 13u32, (_1.3: u32));
|
||||
// switchInt(move _3) -> [false: bb1, otherwise: bb7];
|
||||
// }
|
||||
// bb7: {
|
||||
// _4 = Le((_1.3: u32), const 16u32);
|
||||
// switchInt(move _4) -> [false: bb1, otherwise: bb8];
|
||||
// }
|
||||
// bb8: {
|
||||
// falseEdges -> [real: bb9, imaginary: bb1];
|
||||
// }
|
||||
// bb9: {
|
||||
// StorageLive(_7);
|
||||
// _7 = (_1.0: u32);
|
||||
// StorageLive(_8);
|
||||
// _8 = (_1.3: u32);
|
||||
// StorageLive(_9);
|
||||
// _9 = _7;
|
||||
// StorageLive(_10);
|
||||
// _10 = _8;
|
||||
// _0 = BitXor(move _9, move _10);
|
||||
// StorageDead(_10);
|
||||
// StorageDead(_9);
|
||||
// StorageDead(_8);
|
||||
// StorageDead(_7);
|
||||
// goto -> bb10;
|
||||
// }
|
||||
// bb10: {
|
||||
// return;
|
||||
// }
|
||||
// END rustc.match_tuple.SimplifyCfg-initial.after.mir
|
||||
|
|
|
@ -0,0 +1,113 @@
|
|||
// MIR for `match_tuple` after SimplifyCfg-initial
|
||||
|
||||
fn match_tuple(_1: (u32, bool, std::option::Option<i32>, u32)) -> u32 {
|
||||
debug x => _1; // in scope 0 at $DIR/exponential-or.rs:6:16: 6:17
|
||||
let mut _0: u32; // return place in scope 0 at $DIR/exponential-or.rs:6:53: 6:56
|
||||
let mut _2: isize; // in scope 0 at $DIR/exponential-or.rs:8:37: 8:48
|
||||
let mut _3: bool; // in scope 0 at $DIR/exponential-or.rs:8:70: 8:77
|
||||
let mut _4: bool; // in scope 0 at $DIR/exponential-or.rs:8:70: 8:77
|
||||
let mut _5: bool; // in scope 0 at $DIR/exponential-or.rs:8:62: 8:67
|
||||
let mut _6: bool; // in scope 0 at $DIR/exponential-or.rs:8:62: 8:67
|
||||
let _7: u32; // in scope 0 at $DIR/exponential-or.rs:8:10: 8:21
|
||||
let _8: u32; // in scope 0 at $DIR/exponential-or.rs:8:57: 8:78
|
||||
let mut _9: u32; // in scope 0 at $DIR/exponential-or.rs:8:83: 8:84
|
||||
let mut _10: u32; // in scope 0 at $DIR/exponential-or.rs:8:87: 8:88
|
||||
scope 1 {
|
||||
debug y => _7; // in scope 1 at $DIR/exponential-or.rs:8:10: 8:21
|
||||
debug z => _8; // in scope 1 at $DIR/exponential-or.rs:8:57: 8:78
|
||||
}
|
||||
|
||||
bb0: {
|
||||
FakeRead(ForMatchedPlace, _1); // bb0[0]: scope 0 at $DIR/exponential-or.rs:7:11: 7:12
|
||||
switchInt((_1.0: u32)) -> [1u32: bb2, 4u32: bb2, otherwise: bb1]; // bb0[1]: scope 0 at $DIR/exponential-or.rs:8:15: 8:16
|
||||
}
|
||||
|
||||
bb1: {
|
||||
_0 = const 0u32; // bb1[0]: scope 0 at $DIR/exponential-or.rs:9:14: 9:15
|
||||
// ty::Const
|
||||
// + ty: u32
|
||||
// + val: Value(Scalar(0x00000000))
|
||||
// mir::Constant
|
||||
// + span: $DIR/exponential-or.rs:9:14: 9:15
|
||||
// + literal: Const { ty: u32, val: Value(Scalar(0x00000000)) }
|
||||
goto -> bb10; // bb1[1]: scope 0 at $DIR/exponential-or.rs:7:5: 10:6
|
||||
}
|
||||
|
||||
bb2: {
|
||||
_2 = discriminant((_1.2: std::option::Option<i32>)); // bb2[0]: scope 0 at $DIR/exponential-or.rs:8:37: 8:48
|
||||
switchInt(move _2) -> [0isize: bb4, 1isize: bb3, otherwise: bb1]; // bb2[1]: scope 0 at $DIR/exponential-or.rs:8:37: 8:48
|
||||
}
|
||||
|
||||
bb3: {
|
||||
switchInt((((_1.2: std::option::Option<i32>) as Some).0: i32)) -> [1i32: bb4, 8i32: bb4, otherwise: bb1]; // bb3[0]: scope 0 at $DIR/exponential-or.rs:8:42: 8:43
|
||||
}
|
||||
|
||||
bb4: {
|
||||
_5 = Le(const 6u32, (_1.3: u32)); // bb4[0]: scope 0 at $DIR/exponential-or.rs:8:62: 8:67
|
||||
// ty::Const
|
||||
// + ty: u32
|
||||
// + val: Value(Scalar(0x00000006))
|
||||
// mir::Constant
|
||||
// + span: $DIR/exponential-or.rs:8:62: 8:67
|
||||
// + literal: Const { ty: u32, val: Value(Scalar(0x00000006)) }
|
||||
switchInt(move _5) -> [false: bb6, otherwise: bb5]; // bb4[1]: scope 0 at $DIR/exponential-or.rs:8:62: 8:67
|
||||
}
|
||||
|
||||
bb5: {
|
||||
_6 = Le((_1.3: u32), const 9u32); // bb5[0]: scope 0 at $DIR/exponential-or.rs:8:62: 8:67
|
||||
// ty::Const
|
||||
// + ty: u32
|
||||
// + val: Value(Scalar(0x00000009))
|
||||
// mir::Constant
|
||||
// + span: $DIR/exponential-or.rs:8:62: 8:67
|
||||
// + literal: Const { ty: u32, val: Value(Scalar(0x00000009)) }
|
||||
switchInt(move _6) -> [false: bb6, otherwise: bb8]; // bb5[1]: scope 0 at $DIR/exponential-or.rs:8:62: 8:67
|
||||
}
|
||||
|
||||
bb6: {
|
||||
_3 = Le(const 13u32, (_1.3: u32)); // bb6[0]: scope 0 at $DIR/exponential-or.rs:8:70: 8:77
|
||||
// ty::Const
|
||||
// + ty: u32
|
||||
// + val: Value(Scalar(0x0000000d))
|
||||
// mir::Constant
|
||||
// + span: $DIR/exponential-or.rs:8:70: 8:77
|
||||
// + literal: Const { ty: u32, val: Value(Scalar(0x0000000d)) }
|
||||
switchInt(move _3) -> [false: bb1, otherwise: bb7]; // bb6[1]: scope 0 at $DIR/exponential-or.rs:8:70: 8:77
|
||||
}
|
||||
|
||||
bb7: {
|
||||
_4 = Le((_1.3: u32), const 16u32); // bb7[0]: scope 0 at $DIR/exponential-or.rs:8:70: 8:77
|
||||
// ty::Const
|
||||
// + ty: u32
|
||||
// + val: Value(Scalar(0x00000010))
|
||||
// mir::Constant
|
||||
// + span: $DIR/exponential-or.rs:8:70: 8:77
|
||||
// + literal: Const { ty: u32, val: Value(Scalar(0x00000010)) }
|
||||
switchInt(move _4) -> [false: bb1, otherwise: bb8]; // bb7[1]: scope 0 at $DIR/exponential-or.rs:8:70: 8:77
|
||||
}
|
||||
|
||||
bb8: {
|
||||
falseEdges -> [real: bb9, imaginary: bb1]; // bb8[0]: scope 0 at $DIR/exponential-or.rs:8:9: 8:79
|
||||
}
|
||||
|
||||
bb9: {
|
||||
StorageLive(_7); // bb9[0]: scope 0 at $DIR/exponential-or.rs:8:10: 8:21
|
||||
_7 = (_1.0: u32); // bb9[1]: scope 0 at $DIR/exponential-or.rs:8:10: 8:21
|
||||
StorageLive(_8); // bb9[2]: scope 0 at $DIR/exponential-or.rs:8:57: 8:78
|
||||
_8 = (_1.3: u32); // bb9[3]: scope 0 at $DIR/exponential-or.rs:8:57: 8:78
|
||||
StorageLive(_9); // bb9[4]: scope 1 at $DIR/exponential-or.rs:8:83: 8:84
|
||||
_9 = _7; // bb9[5]: scope 1 at $DIR/exponential-or.rs:8:83: 8:84
|
||||
StorageLive(_10); // bb9[6]: scope 1 at $DIR/exponential-or.rs:8:87: 8:88
|
||||
_10 = _8; // bb9[7]: scope 1 at $DIR/exponential-or.rs:8:87: 8:88
|
||||
_0 = BitXor(move _9, move _10); // bb9[8]: scope 1 at $DIR/exponential-or.rs:8:83: 8:88
|
||||
StorageDead(_10); // bb9[9]: scope 1 at $DIR/exponential-or.rs:8:87: 8:88
|
||||
StorageDead(_9); // bb9[10]: scope 1 at $DIR/exponential-or.rs:8:87: 8:88
|
||||
StorageDead(_8); // bb9[11]: scope 0 at $DIR/exponential-or.rs:8:88: 8:89
|
||||
StorageDead(_7); // bb9[12]: scope 0 at $DIR/exponential-or.rs:8:88: 8:89
|
||||
goto -> bb10; // bb9[13]: scope 0 at $DIR/exponential-or.rs:7:5: 10:6
|
||||
}
|
||||
|
||||
bb10: {
|
||||
return; // bb10[0]: scope 0 at $DIR/exponential-or.rs:11:2: 11:2
|
||||
}
|
||||
}
|
|
@ -3,45 +3,9 @@
|
|||
// Regression test for #58892, generator drop shims should not have blocks
|
||||
// spuriously marked as cleanup
|
||||
|
||||
// EMIT_MIR rustc.main-{{closure}}.generator_drop.0.mir
|
||||
fn main() {
|
||||
let gen = || {
|
||||
yield;
|
||||
};
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
|
||||
// START rustc.main-{{closure}}.generator_drop.0.mir
|
||||
// bb0: {
|
||||
// _7 = discriminant((*_1));
|
||||
// switchInt(move _7) -> [0u32: bb4, 3u32: bb7, otherwise: bb8];
|
||||
// }
|
||||
// bb1: {
|
||||
// StorageDead(_4);
|
||||
// StorageDead(_3);
|
||||
// goto -> bb5;
|
||||
// }
|
||||
// bb2: {
|
||||
// return;
|
||||
// }
|
||||
// bb3: {
|
||||
// return;
|
||||
// }
|
||||
// bb4: {
|
||||
// goto -> bb6;
|
||||
// }
|
||||
// bb5: {
|
||||
// goto -> bb2;
|
||||
// }
|
||||
// bb6: {
|
||||
// goto -> bb3;
|
||||
// }
|
||||
// bb7: {
|
||||
// StorageLive(_3);
|
||||
// StorageLive(_4);
|
||||
// goto -> bb1;
|
||||
// }
|
||||
// bb8: {
|
||||
// return;
|
||||
// }
|
||||
// END rustc.main-{{closure}}.generator_drop.0.mir
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
// MIR for `main::{{closure}}#0` 0 generator_drop
|
||||
// generator_layout = GeneratorLayout { field_tys: [], variant_fields: [[], [], [], []], storage_conflicts: BitMatrix { num_rows: 0, num_columns: 0, words: [], marker: PhantomData } }
|
||||
|
||||
fn main::{{closure}}#0(_1: *mut [generator@$DIR/generator-drop-cleanup.rs:8:15: 10:6 {()}]) -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/generator-drop-cleanup.rs:8:15: 10:6
|
||||
let mut _2: (); // in scope 0 at $DIR/generator-drop-cleanup.rs:8:15: 10:6
|
||||
let _3: (); // in scope 0 at $DIR/generator-drop-cleanup.rs:9:9: 9:14
|
||||
let mut _4: (); // in scope 0 at $DIR/generator-drop-cleanup.rs:9:9: 9:14
|
||||
let mut _5: (); // in scope 0 at $DIR/generator-drop-cleanup.rs:8:18: 8:18
|
||||
let mut _6: (); // in scope 0 at $DIR/generator-drop-cleanup.rs:8:15: 10:6
|
||||
let mut _7: isize; // in scope 0 at $DIR/generator-drop-cleanup.rs:8:15: 10:6
|
||||
|
||||
bb0: {
|
||||
_7 = discriminant((*_1)); // bb0[0]: scope 0 at $DIR/generator-drop-cleanup.rs:8:15: 10:6
|
||||
switchInt(move _7) -> [0u32: bb4, 3u32: bb7, otherwise: bb8]; // bb0[1]: scope 0 at $DIR/generator-drop-cleanup.rs:8:15: 10:6
|
||||
}
|
||||
|
||||
bb1: {
|
||||
StorageDead(_4); // bb1[0]: scope 0 at $DIR/generator-drop-cleanup.rs:9:13: 9:14
|
||||
StorageDead(_3); // bb1[1]: scope 0 at $DIR/generator-drop-cleanup.rs:9:14: 9:15
|
||||
goto -> bb5; // bb1[2]: scope 0 at $DIR/generator-drop-cleanup.rs:10:5: 10:6
|
||||
}
|
||||
|
||||
bb2: {
|
||||
return; // bb2[0]: scope 0 at $DIR/generator-drop-cleanup.rs:8:15: 10:6
|
||||
}
|
||||
|
||||
bb3: {
|
||||
return; // bb3[0]: scope 0 at $DIR/generator-drop-cleanup.rs:8:15: 10:6
|
||||
}
|
||||
|
||||
bb4: {
|
||||
goto -> bb6; // bb4[0]: scope 0 at $DIR/generator-drop-cleanup.rs:8:15: 10:6
|
||||
}
|
||||
|
||||
bb5: {
|
||||
goto -> bb2; // bb5[0]: scope 0 at $DIR/generator-drop-cleanup.rs:10:5: 10:6
|
||||
}
|
||||
|
||||
bb6: {
|
||||
goto -> bb3; // bb6[0]: scope 0 at $DIR/generator-drop-cleanup.rs:8:15: 10:6
|
||||
}
|
||||
|
||||
bb7: {
|
||||
StorageLive(_3); // bb7[0]: scope 0 at $DIR/generator-drop-cleanup.rs:8:15: 10:6
|
||||
StorageLive(_4); // bb7[1]: scope 0 at $DIR/generator-drop-cleanup.rs:8:15: 10:6
|
||||
goto -> bb1; // bb7[2]: scope 0 at $DIR/generator-drop-cleanup.rs:8:15: 10:6
|
||||
}
|
||||
|
||||
bb8: {
|
||||
return; // bb8[0]: scope 0 at $DIR/generator-drop-cleanup.rs:8:15: 10:6
|
||||
}
|
||||
}
|
|
@ -17,6 +17,7 @@ struct Bar(i32);
|
|||
|
||||
fn take<T>(_x: T) {}
|
||||
|
||||
// EMIT_MIR rustc.main-{{closure}}.StateTransform.before.mir
|
||||
fn main() {
|
||||
let _gen = || {
|
||||
let a = Foo(5);
|
||||
|
@ -26,89 +27,3 @@ fn main() {
|
|||
take(b);
|
||||
};
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
|
||||
// START rustc.main-{{closure}}.StateTransform.before.mir
|
||||
// ...
|
||||
// let _3: Foo;
|
||||
// ...
|
||||
// let mut _8: Foo;
|
||||
// ...
|
||||
// let mut _10: Bar;
|
||||
// scope 1 {
|
||||
// debug a => _3;
|
||||
// let _4: Bar;
|
||||
// scope 2 {
|
||||
// debug b => _4;
|
||||
// }
|
||||
// }
|
||||
// bb0: {
|
||||
// StorageLive(_3);
|
||||
// _3 = Foo(const 5i32,);
|
||||
// StorageLive(_4);
|
||||
// _4 = Bar(const 6i32,);
|
||||
// ...
|
||||
// _5 = yield(move _6) -> [resume: bb2, drop: bb4];
|
||||
// }
|
||||
// bb1 (cleanup): {
|
||||
// resume;
|
||||
// }
|
||||
// bb2: {
|
||||
// ...
|
||||
// StorageLive(_7);
|
||||
// StorageLive(_8);
|
||||
// _8 = move _3;
|
||||
// _7 = const take::<Foo>(move _8) -> [return: bb7, unwind: bb9];
|
||||
// }
|
||||
// bb3 (cleanup): {
|
||||
// StorageDead(_3);
|
||||
// drop(_1) -> bb1;
|
||||
// }
|
||||
// bb4: {
|
||||
// ...
|
||||
// StorageDead(_4);
|
||||
// drop(_3) -> [return: bb5, unwind: bb3];
|
||||
// }
|
||||
// bb5: {
|
||||
// StorageDead(_3);
|
||||
// drop(_1) -> [return: bb6, unwind: bb1];
|
||||
// }
|
||||
// bb6: {
|
||||
// generator_drop;
|
||||
// }
|
||||
// bb7: {
|
||||
// StorageDead(_8);
|
||||
// StorageDead(_7);
|
||||
// StorageLive(_9);
|
||||
// StorageLive(_10);
|
||||
// _10 = move _4;
|
||||
// _9 = const take::<Bar>(move _10) -> [return: bb10, unwind: bb11];
|
||||
// }
|
||||
// bb8 (cleanup): {
|
||||
// StorageDead(_4);
|
||||
// StorageDead(_3);
|
||||
// drop(_1) -> bb1;
|
||||
// }
|
||||
// bb9 (cleanup): {
|
||||
// StorageDead(_8);
|
||||
// StorageDead(_7);
|
||||
// goto -> bb8;
|
||||
// }
|
||||
// bb10: {
|
||||
// StorageDead(_10);
|
||||
// StorageDead(_9);
|
||||
// ...
|
||||
// StorageDead(_4);
|
||||
// StorageDead(_3);
|
||||
// drop(_1) -> [return: bb12, unwind: bb1];
|
||||
// }
|
||||
// bb11 (cleanup): {
|
||||
// StorageDead(_10);
|
||||
// StorageDead(_9);
|
||||
// goto -> bb8;
|
||||
// }
|
||||
// bb12: {
|
||||
// return;
|
||||
// }
|
||||
// END rustc.main-{{closure}}.StateTransform.before.mir
|
||||
|
|
|
@ -0,0 +1,130 @@
|
|||
// MIR for `main::{{closure}}#0` before StateTransform
|
||||
|
||||
fn main::{{closure}}#0(_1: [generator@$DIR/generator-storage-dead-unwind.rs:22:16: 28:6 {Foo, Bar, ()}], _2: ()) -> ()
|
||||
yields ()
|
||||
{
|
||||
let mut _0: (); // return place in scope 0 at $DIR/generator-storage-dead-unwind.rs:22:19: 22:19
|
||||
let _3: Foo; // in scope 0 at $DIR/generator-storage-dead-unwind.rs:23:13: 23:14
|
||||
let _5: (); // in scope 0 at $DIR/generator-storage-dead-unwind.rs:25:9: 25:14
|
||||
let mut _6: (); // in scope 0 at $DIR/generator-storage-dead-unwind.rs:25:9: 25:14
|
||||
let _7: (); // in scope 0 at $DIR/generator-storage-dead-unwind.rs:26:9: 26:16
|
||||
let mut _8: Foo; // in scope 0 at $DIR/generator-storage-dead-unwind.rs:26:14: 26:15
|
||||
let _9: (); // in scope 0 at $DIR/generator-storage-dead-unwind.rs:27:9: 27:16
|
||||
let mut _10: Bar; // in scope 0 at $DIR/generator-storage-dead-unwind.rs:27:14: 27:15
|
||||
scope 1 {
|
||||
debug a => _3; // in scope 1 at $DIR/generator-storage-dead-unwind.rs:23:13: 23:14
|
||||
let _4: Bar; // in scope 1 at $DIR/generator-storage-dead-unwind.rs:24:13: 24:14
|
||||
scope 2 {
|
||||
debug b => _4; // in scope 2 at $DIR/generator-storage-dead-unwind.rs:24:13: 24:14
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_3); // bb0[0]: scope 0 at $DIR/generator-storage-dead-unwind.rs:23:13: 23:14
|
||||
_3 = Foo(const 5i32,); // bb0[1]: scope 0 at $DIR/generator-storage-dead-unwind.rs:23:17: 23:23
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000005))
|
||||
// mir::Constant
|
||||
// + span: $DIR/generator-storage-dead-unwind.rs:23:21: 23:22
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000005)) }
|
||||
StorageLive(_4); // bb0[2]: scope 1 at $DIR/generator-storage-dead-unwind.rs:24:13: 24:14
|
||||
_4 = Bar(const 6i32,); // bb0[3]: scope 1 at $DIR/generator-storage-dead-unwind.rs:24:17: 24:23
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000006))
|
||||
// mir::Constant
|
||||
// + span: $DIR/generator-storage-dead-unwind.rs:24:21: 24:22
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000006)) }
|
||||
StorageLive(_5); // bb0[4]: scope 2 at $DIR/generator-storage-dead-unwind.rs:25:9: 25:14
|
||||
StorageLive(_6); // bb0[5]: scope 2 at $DIR/generator-storage-dead-unwind.rs:25:9: 25:14
|
||||
_6 = (); // bb0[6]: scope 2 at $DIR/generator-storage-dead-unwind.rs:25:9: 25:14
|
||||
_5 = yield(move _6) -> [resume: bb2, drop: bb4]; // bb0[7]: scope 2 at $DIR/generator-storage-dead-unwind.rs:25:9: 25:14
|
||||
}
|
||||
|
||||
bb1 (cleanup): {
|
||||
resume; // bb1[0]: scope 0 at $DIR/generator-storage-dead-unwind.rs:22:16: 28:6
|
||||
}
|
||||
|
||||
bb2: {
|
||||
StorageDead(_6); // bb2[0]: scope 2 at $DIR/generator-storage-dead-unwind.rs:25:13: 25:14
|
||||
StorageDead(_5); // bb2[1]: scope 2 at $DIR/generator-storage-dead-unwind.rs:25:14: 25:15
|
||||
StorageLive(_7); // bb2[2]: scope 2 at $DIR/generator-storage-dead-unwind.rs:26:9: 26:16
|
||||
StorageLive(_8); // bb2[3]: scope 2 at $DIR/generator-storage-dead-unwind.rs:26:14: 26:15
|
||||
_8 = move _3; // bb2[4]: scope 2 at $DIR/generator-storage-dead-unwind.rs:26:14: 26:15
|
||||
_7 = const take::<Foo>(move _8) -> [return: bb7, unwind: bb9]; // bb2[5]: scope 2 at $DIR/generator-storage-dead-unwind.rs:26:9: 26:16
|
||||
// ty::Const
|
||||
// + ty: fn(Foo) {take::<Foo>}
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $DIR/generator-storage-dead-unwind.rs:26:9: 26:13
|
||||
// + literal: Const { ty: fn(Foo) {take::<Foo>}, val: Value(Scalar(<ZST>)) }
|
||||
}
|
||||
|
||||
bb3 (cleanup): {
|
||||
StorageDead(_3); // bb3[0]: scope 0 at $DIR/generator-storage-dead-unwind.rs:28:5: 28:6
|
||||
drop(_1) -> bb1; // bb3[1]: scope 0 at $DIR/generator-storage-dead-unwind.rs:28:5: 28:6
|
||||
}
|
||||
|
||||
bb4: {
|
||||
StorageDead(_6); // bb4[0]: scope 2 at $DIR/generator-storage-dead-unwind.rs:25:13: 25:14
|
||||
StorageDead(_5); // bb4[1]: scope 2 at $DIR/generator-storage-dead-unwind.rs:25:14: 25:15
|
||||
StorageDead(_4); // bb4[2]: scope 1 at $DIR/generator-storage-dead-unwind.rs:28:5: 28:6
|
||||
drop(_3) -> [return: bb5, unwind: bb3]; // bb4[3]: scope 0 at $DIR/generator-storage-dead-unwind.rs:28:5: 28:6
|
||||
}
|
||||
|
||||
bb5: {
|
||||
StorageDead(_3); // bb5[0]: scope 0 at $DIR/generator-storage-dead-unwind.rs:28:5: 28:6
|
||||
drop(_1) -> [return: bb6, unwind: bb1]; // bb5[1]: scope 0 at $DIR/generator-storage-dead-unwind.rs:28:5: 28:6
|
||||
}
|
||||
|
||||
bb6: {
|
||||
generator_drop; // bb6[0]: scope 0 at $DIR/generator-storage-dead-unwind.rs:22:16: 28:6
|
||||
}
|
||||
|
||||
bb7: {
|
||||
StorageDead(_8); // bb7[0]: scope 2 at $DIR/generator-storage-dead-unwind.rs:26:15: 26:16
|
||||
StorageDead(_7); // bb7[1]: scope 2 at $DIR/generator-storage-dead-unwind.rs:26:16: 26:17
|
||||
StorageLive(_9); // bb7[2]: scope 2 at $DIR/generator-storage-dead-unwind.rs:27:9: 27:16
|
||||
StorageLive(_10); // bb7[3]: scope 2 at $DIR/generator-storage-dead-unwind.rs:27:14: 27:15
|
||||
_10 = move _4; // bb7[4]: scope 2 at $DIR/generator-storage-dead-unwind.rs:27:14: 27:15
|
||||
_9 = const take::<Bar>(move _10) -> [return: bb10, unwind: bb11]; // bb7[5]: scope 2 at $DIR/generator-storage-dead-unwind.rs:27:9: 27:16
|
||||
// ty::Const
|
||||
// + ty: fn(Bar) {take::<Bar>}
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $DIR/generator-storage-dead-unwind.rs:27:9: 27:13
|
||||
// + literal: Const { ty: fn(Bar) {take::<Bar>}, val: Value(Scalar(<ZST>)) }
|
||||
}
|
||||
|
||||
bb8 (cleanup): {
|
||||
StorageDead(_4); // bb8[0]: scope 1 at $DIR/generator-storage-dead-unwind.rs:28:5: 28:6
|
||||
StorageDead(_3); // bb8[1]: scope 0 at $DIR/generator-storage-dead-unwind.rs:28:5: 28:6
|
||||
drop(_1) -> bb1; // bb8[2]: scope 0 at $DIR/generator-storage-dead-unwind.rs:28:5: 28:6
|
||||
}
|
||||
|
||||
bb9 (cleanup): {
|
||||
StorageDead(_8); // bb9[0]: scope 2 at $DIR/generator-storage-dead-unwind.rs:26:15: 26:16
|
||||
StorageDead(_7); // bb9[1]: scope 2 at $DIR/generator-storage-dead-unwind.rs:26:16: 26:17
|
||||
goto -> bb8; // bb9[2]: scope 2 at $DIR/generator-storage-dead-unwind.rs:1:1: 1:1
|
||||
}
|
||||
|
||||
bb10: {
|
||||
StorageDead(_10); // bb10[0]: scope 2 at $DIR/generator-storage-dead-unwind.rs:27:15: 27:16
|
||||
StorageDead(_9); // bb10[1]: scope 2 at $DIR/generator-storage-dead-unwind.rs:27:16: 27:17
|
||||
_0 = (); // bb10[2]: scope 0 at $DIR/generator-storage-dead-unwind.rs:22:19: 28:6
|
||||
StorageDead(_4); // bb10[3]: scope 1 at $DIR/generator-storage-dead-unwind.rs:28:5: 28:6
|
||||
StorageDead(_3); // bb10[4]: scope 0 at $DIR/generator-storage-dead-unwind.rs:28:5: 28:6
|
||||
drop(_1) -> [return: bb12, unwind: bb1]; // bb10[5]: scope 0 at $DIR/generator-storage-dead-unwind.rs:28:5: 28:6
|
||||
}
|
||||
|
||||
bb11 (cleanup): {
|
||||
StorageDead(_10); // bb11[0]: scope 2 at $DIR/generator-storage-dead-unwind.rs:27:15: 27:16
|
||||
StorageDead(_9); // bb11[1]: scope 2 at $DIR/generator-storage-dead-unwind.rs:27:16: 27:17
|
||||
goto -> bb8; // bb11[2]: scope 2 at $DIR/generator-storage-dead-unwind.rs:1:1: 1:1
|
||||
}
|
||||
|
||||
bb12: {
|
||||
return; // bb12[0]: scope 0 at $DIR/generator-storage-dead-unwind.rs:28:6: 28:6
|
||||
}
|
||||
}
|
|
@ -13,6 +13,7 @@ impl Drop for HasDrop {
|
|||
|
||||
fn callee() {}
|
||||
|
||||
// EMIT_MIR rustc.main-{{closure}}.generator_resume.0.mir
|
||||
fn main() {
|
||||
let _gen = |_x: u8| {
|
||||
let _d = HasDrop;
|
||||
|
@ -22,13 +23,3 @@ fn main() {
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
|
||||
// START rustc.main-{{closure}}.generator_resume.0.mir
|
||||
// bb0: {
|
||||
// ...
|
||||
// switchInt(move _11) -> [0u32: bb1, 3u32: bb5, otherwise: bb6];
|
||||
// }
|
||||
// ...
|
||||
// END rustc.main-{{closure}}.generator_resume.0.mir
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
// MIR for `main::{{closure}}#0` 0 generator_resume
|
||||
// generator_layout = GeneratorLayout { field_tys: [HasDrop], variant_fields: [[], [], [], [_0]], storage_conflicts: BitMatrix { num_rows: 1, num_columns: 1, words: [1], marker: PhantomData } }
|
||||
|
||||
fn main::{{closure}}#0(_1: std::pin::Pin<&mut [generator@$DIR/generator-tiny.rs:18:16: 24:6 {u8, HasDrop, ()}]>, _2: u8) -> std::ops::GeneratorState<(), ()> {
|
||||
debug _x => _10; // in scope 0 at $DIR/generator-tiny.rs:18:17: 18:19
|
||||
let mut _0: std::ops::GeneratorState<(), ()>; // return place in scope 0 at $DIR/generator-tiny.rs:18:16: 24:6
|
||||
let _3: HasDrop; // in scope 0 at $DIR/generator-tiny.rs:19:13: 19:15
|
||||
let mut _4: !; // in scope 0 at $DIR/generator-tiny.rs:20:9: 23:10
|
||||
let mut _5: (); // in scope 0 at $DIR/generator-tiny.rs:18:16: 24:6
|
||||
let _6: u8; // in scope 0 at $DIR/generator-tiny.rs:21:13: 21:18
|
||||
let mut _7: (); // in scope 0 at $DIR/generator-tiny.rs:21:13: 21:18
|
||||
let _8: (); // in scope 0 at $DIR/generator-tiny.rs:22:13: 22:21
|
||||
let mut _9: (); // in scope 0 at $DIR/generator-tiny.rs:18:25: 18:25
|
||||
let _10: u8; // in scope 0 at $DIR/generator-tiny.rs:18:17: 18:19
|
||||
let mut _11: isize; // in scope 0 at $DIR/generator-tiny.rs:18:16: 24:6
|
||||
scope 1 {
|
||||
debug _d => (((*(_1.0: &mut [generator@$DIR/generator-tiny.rs:18:16: 24:6 {u8, HasDrop, ()}])) as variant#3).0: HasDrop); // in scope 1 at $DIR/generator-tiny.rs:19:13: 19:15
|
||||
}
|
||||
|
||||
bb0: {
|
||||
_11 = discriminant((*(_1.0: &mut [generator@$DIR/generator-tiny.rs:18:16: 24:6 {u8, HasDrop, ()}]))); // bb0[0]: scope 0 at $DIR/generator-tiny.rs:18:16: 24:6
|
||||
switchInt(move _11) -> [0u32: bb1, 3u32: bb5, otherwise: bb6]; // bb0[1]: scope 0 at $DIR/generator-tiny.rs:18:16: 24:6
|
||||
}
|
||||
|
||||
bb1: {
|
||||
_10 = move _2; // bb1[0]: scope 0 at $DIR/generator-tiny.rs:18:16: 24:6
|
||||
nop; // bb1[1]: scope 0 at $DIR/generator-tiny.rs:19:13: 19:15
|
||||
(((*(_1.0: &mut [generator@$DIR/generator-tiny.rs:18:16: 24:6 {u8, HasDrop, ()}])) as variant#3).0: HasDrop) = HasDrop; // bb1[2]: scope 0 at $DIR/generator-tiny.rs:19:18: 19:25
|
||||
StorageLive(_4); // bb1[3]: scope 1 at $DIR/generator-tiny.rs:20:9: 23:10
|
||||
goto -> bb2; // bb1[4]: scope 1 at $DIR/generator-tiny.rs:20:9: 23:10
|
||||
}
|
||||
|
||||
bb2: {
|
||||
StorageLive(_6); // bb2[0]: scope 1 at $DIR/generator-tiny.rs:21:13: 21:18
|
||||
StorageLive(_7); // bb2[1]: scope 1 at $DIR/generator-tiny.rs:21:13: 21:18
|
||||
_7 = (); // bb2[2]: scope 1 at $DIR/generator-tiny.rs:21:13: 21:18
|
||||
_0 = std::ops::GeneratorState::<(), ()>::Yielded(move _7,); // bb2[3]: scope 1 at $DIR/generator-tiny.rs:21:13: 21:18
|
||||
discriminant((*(_1.0: &mut [generator@$DIR/generator-tiny.rs:18:16: 24:6 {u8, HasDrop, ()}]))) = 3; // bb2[4]: scope 1 at $DIR/generator-tiny.rs:21:13: 21:18
|
||||
return; // bb2[5]: scope 1 at $DIR/generator-tiny.rs:21:13: 21:18
|
||||
}
|
||||
|
||||
bb3: {
|
||||
StorageDead(_7); // bb3[0]: scope 1 at $DIR/generator-tiny.rs:21:17: 21:18
|
||||
StorageDead(_6); // bb3[1]: scope 1 at $DIR/generator-tiny.rs:21:18: 21:19
|
||||
StorageLive(_8); // bb3[2]: scope 1 at $DIR/generator-tiny.rs:22:13: 22:21
|
||||
_8 = const callee() -> bb4; // bb3[3]: scope 1 at $DIR/generator-tiny.rs:22:13: 22:21
|
||||
// ty::Const
|
||||
// + ty: fn() {callee}
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $DIR/generator-tiny.rs:22:13: 22:19
|
||||
// + literal: Const { ty: fn() {callee}, val: Value(Scalar(<ZST>)) }
|
||||
}
|
||||
|
||||
bb4: {
|
||||
StorageDead(_8); // bb4[0]: scope 1 at $DIR/generator-tiny.rs:22:21: 22:22
|
||||
_5 = (); // bb4[1]: scope 1 at $DIR/generator-tiny.rs:20:14: 23:10
|
||||
goto -> bb2; // bb4[2]: scope 1 at $DIR/generator-tiny.rs:20:9: 23:10
|
||||
}
|
||||
|
||||
bb5: {
|
||||
StorageLive(_4); // bb5[0]: scope 0 at $DIR/generator-tiny.rs:18:16: 24:6
|
||||
StorageLive(_6); // bb5[1]: scope 0 at $DIR/generator-tiny.rs:18:16: 24:6
|
||||
StorageLive(_7); // bb5[2]: scope 0 at $DIR/generator-tiny.rs:18:16: 24:6
|
||||
_6 = move _2; // bb5[3]: scope 0 at $DIR/generator-tiny.rs:18:16: 24:6
|
||||
goto -> bb3; // bb5[4]: scope 0 at $DIR/generator-tiny.rs:18:16: 24:6
|
||||
}
|
||||
|
||||
bb6: {
|
||||
unreachable; // bb6[0]: scope 0 at $DIR/generator-tiny.rs:18:16: 24:6
|
||||
}
|
||||
}
|
|
@ -1,20 +1,5 @@
|
|||
// Test graphviz output
|
||||
// compile-flags: -Z dump-mir-graphviz
|
||||
|
||||
// ignore-tidy-linelength
|
||||
|
||||
// EMIT_MIR rustc.main.mir_map.0.dot
|
||||
fn main() {}
|
||||
|
||||
// END RUST SOURCE
|
||||
// START rustc.main.mir_map.0.dot
|
||||
// digraph Mir_0_3 { // The name here MUST be an ASCII identifier.
|
||||
// graph [fontname="monospace"];
|
||||
// node [fontname="monospace"];
|
||||
// edge [fontname="monospace"];
|
||||
// label=<fn main() -> ()<br align="left"/>>;
|
||||
// bb0__0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">0</td></tr><tr><td align="left" balign="left">_0 = ()<br/></td></tr><tr><td align="left">goto</td></tr></table>>];
|
||||
// bb1__0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">1</td></tr><tr><td align="left">resume</td></tr></table>>];
|
||||
// bb2__0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">2</td></tr><tr><td align="left">return</td></tr></table>>];
|
||||
// bb0__0_3 -> bb2__0_3 [label=""];
|
||||
// }
|
||||
// END rustc.main.mir_map.0.dot
|
||||
|
|
10
src/test/mir-opt/graphviz/rustc.main.mir_map.0.dot
Normal file
10
src/test/mir-opt/graphviz/rustc.main.mir_map.0.dot
Normal file
|
@ -0,0 +1,10 @@
|
|||
digraph Mir_0_3 {
|
||||
graph [fontname="monospace"];
|
||||
node [fontname="monospace"];
|
||||
edge [fontname="monospace"];
|
||||
label=<fn main() -> ()<br align="left"/>>;
|
||||
bb0__0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">0</td></tr><tr><td align="left" balign="left">_0 = ()<br/></td></tr><tr><td align="left">goto</td></tr></table>>];
|
||||
bb1__0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">1</td></tr><tr><td align="left">resume</td></tr></table>>];
|
||||
bb2__0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">2</td></tr><tr><td align="left">return</td></tr></table>>];
|
||||
bb0__0_3 -> bb2__0_3 [label=""];
|
||||
}
|
|
@ -6,6 +6,7 @@ fn main() {
|
|||
println!("{}", bar());
|
||||
}
|
||||
|
||||
// EMIT_MIR rustc.bar.Inline.after.mir
|
||||
fn bar() -> bool {
|
||||
let f = foo;
|
||||
f(1, -1)
|
||||
|
@ -15,15 +16,3 @@ fn bar() -> bool {
|
|||
fn foo(x: i32, y: i32) -> bool {
|
||||
x == y
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
// START rustc.bar.Inline.after.mir
|
||||
// ...
|
||||
// bb0: {
|
||||
// ...
|
||||
// _0 = Eq(move _3, move _4);
|
||||
// ...
|
||||
// return;
|
||||
// }
|
||||
// ...
|
||||
// END rustc.bar.Inline.after.mir
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
// MIR for `bar` after Inline
|
||||
|
||||
fn bar() -> bool {
|
||||
let mut _0: bool; // return place in scope 0 at $DIR/inline-any-operand.rs:10:13: 10:17
|
||||
let _1: fn(i32, i32) -> bool {foo}; // in scope 0 at $DIR/inline-any-operand.rs:11:9: 11:10
|
||||
let mut _2: fn(i32, i32) -> bool {foo}; // in scope 0 at $DIR/inline-any-operand.rs:12:5: 12:6
|
||||
let mut _3: i32; // in scope 0 at $DIR/inline-any-operand.rs:12:5: 12:13
|
||||
let mut _4: i32; // in scope 0 at $DIR/inline-any-operand.rs:12:5: 12:13
|
||||
scope 1 {
|
||||
debug f => _1; // in scope 1 at $DIR/inline-any-operand.rs:11:9: 11:10
|
||||
scope 2 {
|
||||
debug x => _3; // in scope 2 at $DIR/inline-any-operand.rs:16:8: 16:9
|
||||
debug y => _4; // in scope 2 at $DIR/inline-any-operand.rs:16:16: 16:17
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/inline-any-operand.rs:11:9: 11:10
|
||||
_1 = const foo; // bb0[1]: scope 0 at $DIR/inline-any-operand.rs:11:13: 11:16
|
||||
// ty::Const
|
||||
// + ty: fn(i32, i32) -> bool {foo}
|
||||
// + val: Value(Scalar(<ZST>))
|
||||
// mir::Constant
|
||||
// + span: $DIR/inline-any-operand.rs:11:13: 11:16
|
||||
// + literal: Const { ty: fn(i32, i32) -> bool {foo}, val: Value(Scalar(<ZST>)) }
|
||||
StorageLive(_2); // bb0[2]: scope 1 at $DIR/inline-any-operand.rs:12:5: 12:6
|
||||
_2 = _1; // bb0[3]: scope 1 at $DIR/inline-any-operand.rs:12:5: 12:6
|
||||
_3 = const 1i32; // bb0[4]: scope 1 at $DIR/inline-any-operand.rs:12:5: 12:13
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0x00000001))
|
||||
// mir::Constant
|
||||
// + span: $DIR/inline-any-operand.rs:12:7: 12:8
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) }
|
||||
_4 = const -1i32; // bb0[5]: scope 1 at $DIR/inline-any-operand.rs:12:5: 12:13
|
||||
// ty::Const
|
||||
// + ty: i32
|
||||
// + val: Value(Scalar(0xffffffff))
|
||||
// mir::Constant
|
||||
// + span: $DIR/inline-any-operand.rs:12:10: 12:12
|
||||
// + literal: Const { ty: i32, val: Value(Scalar(0xffffffff)) }
|
||||
_0 = Eq(move _3, move _4); // bb0[6]: scope 2 at $DIR/inline-any-operand.rs:17:5: 17:11
|
||||
StorageDead(_2); // bb0[7]: scope 1 at $DIR/inline-any-operand.rs:12:12: 12:13
|
||||
StorageDead(_1); // bb0[8]: scope 0 at $DIR/inline-any-operand.rs:13:1: 13:2
|
||||
return; // bb0[9]: scope 0 at $DIR/inline-any-operand.rs:13:2: 13:2
|
||||
}
|
||||
}
|
|
@ -7,6 +7,7 @@ fn main() {
|
|||
println!("{}", foo(0, &14));
|
||||
}
|
||||
|
||||
// EMIT_MIR rustc.foo.Inline.after.mir
|
||||
fn foo<T: Copy>(_t: T, q: &i32) -> i32 {
|
||||
let x = |r: &i32, _s: &i32| {
|
||||
let variable = &*r;
|
||||
|
@ -14,46 +15,3 @@ fn foo<T: Copy>(_t: T, q: &i32) -> i32 {
|
|||
};
|
||||
x(q, q)
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
// START rustc.foo.Inline.after.mir
|
||||
// fn foo(_1: T, _2: &i32) -> i32{
|
||||
// debug _t => _1;
|
||||
// debug q => _2;
|
||||
// let mut _0: i32;
|
||||
// let _3: [closure@foo<T>::{{closure}}#0];
|
||||
// let mut _4: &[closure@foo<T>::{{closure}}#0];
|
||||
// let mut _5: (&i32, &i32);
|
||||
// let mut _6: &i32;
|
||||
// let mut _7: &i32;
|
||||
// let mut _8: &i32;
|
||||
// let mut _9: &i32;
|
||||
// scope 1 {
|
||||
// debug x => _3;
|
||||
// scope 2 {
|
||||
// debug r => _8;
|
||||
// debug _s => _9;
|
||||
// }
|
||||
// }
|
||||
// scope 3 {
|
||||
// debug variable => _8;
|
||||
// }
|
||||
// bb0: {
|
||||
// ...
|
||||
// _3 = [closure@foo::<T>::{{closure}}#0];
|
||||
// ...
|
||||
// _4 = &_3;
|
||||
// ...
|
||||
// _6 = &(*_2);
|
||||
// ...
|
||||
// _7 = &(*_2);
|
||||
// _5 = (move _6, move _7);
|
||||
// _8 = move (_5.0: &i32);
|
||||
// _9 = move (_5.1: &i32);
|
||||
// ...
|
||||
// _0 = (*_8);
|
||||
// ...
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// END rustc.foo.Inline.after.mir
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
// MIR for `foo` after Inline
|
||||
|
||||
fn foo(_1: T, _2: &i32) -> i32 {
|
||||
debug _t => _1; // in scope 0 at $DIR/inline-closure-borrows-arg.rs:11:17: 11:19
|
||||
debug q => _2; // in scope 0 at $DIR/inline-closure-borrows-arg.rs:11:24: 11:25
|
||||
let mut _0: i32; // return place in scope 0 at $DIR/inline-closure-borrows-arg.rs:11:36: 11:39
|
||||
let _3: [closure@foo<T>::{{closure}}#0]; // in scope 0 at $DIR/inline-closure-borrows-arg.rs:12:9: 12:10
|
||||
let mut _4: &[closure@foo<T>::{{closure}}#0]; // in scope 0 at $DIR/inline-closure-borrows-arg.rs:16:5: 16:6
|
||||
let mut _5: (&i32, &i32); // in scope 0 at $DIR/inline-closure-borrows-arg.rs:16:5: 16:12
|
||||
let mut _6: &i32; // in scope 0 at $DIR/inline-closure-borrows-arg.rs:16:7: 16:8
|
||||
let mut _7: &i32; // in scope 0 at $DIR/inline-closure-borrows-arg.rs:16:10: 16:11
|
||||
let mut _8: &i32; // in scope 0 at $DIR/inline-closure-borrows-arg.rs:16:5: 16:12
|
||||
let mut _9: &i32; // in scope 0 at $DIR/inline-closure-borrows-arg.rs:16:5: 16:12
|
||||
scope 1 {
|
||||
debug x => _3; // in scope 1 at $DIR/inline-closure-borrows-arg.rs:12:9: 12:10
|
||||
scope 2 {
|
||||
debug r => _8; // in scope 2 at $DIR/inline-closure-borrows-arg.rs:12:14: 12:15
|
||||
debug _s => _9; // in scope 2 at $DIR/inline-closure-borrows-arg.rs:12:23: 12:25
|
||||
}
|
||||
}
|
||||
scope 3 {
|
||||
debug variable => _8; // in scope 3 at $DIR/inline-closure-borrows-arg.rs:13:13: 13:21
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_3); // bb0[0]: scope 0 at $DIR/inline-closure-borrows-arg.rs:12:9: 12:10
|
||||
_3 = [closure@foo::<T>::{{closure}}#0]; // bb0[1]: scope 0 at $DIR/inline-closure-borrows-arg.rs:12:13: 15:6
|
||||
// closure
|
||||
// + def_id: DefId(0:6 ~ inline_closure_borrows_arg[317d]::foo[0]::{{closure}}[0])
|
||||
// + substs: [
|
||||
// T,
|
||||
// i8,
|
||||
// for<'r, 's> extern "rust-call" fn((&'r i32, &'s i32)) -> i32,
|
||||
// (),
|
||||
// ]
|
||||
StorageLive(_4); // bb0[2]: scope 1 at $DIR/inline-closure-borrows-arg.rs:16:5: 16:6
|
||||
_4 = &_3; // bb0[3]: scope 1 at $DIR/inline-closure-borrows-arg.rs:16:5: 16:6
|
||||
StorageLive(_5); // bb0[4]: scope 1 at $DIR/inline-closure-borrows-arg.rs:16:5: 16:12
|
||||
StorageLive(_6); // bb0[5]: scope 1 at $DIR/inline-closure-borrows-arg.rs:16:7: 16:8
|
||||
_6 = &(*_2); // bb0[6]: scope 1 at $DIR/inline-closure-borrows-arg.rs:16:7: 16:8
|
||||
StorageLive(_7); // bb0[7]: scope 1 at $DIR/inline-closure-borrows-arg.rs:16:10: 16:11
|
||||
_7 = &(*_2); // bb0[8]: scope 1 at $DIR/inline-closure-borrows-arg.rs:16:10: 16:11
|
||||
_5 = (move _6, move _7); // bb0[9]: scope 1 at $DIR/inline-closure-borrows-arg.rs:16:5: 16:12
|
||||
_8 = move (_5.0: &i32); // bb0[10]: scope 1 at $DIR/inline-closure-borrows-arg.rs:16:5: 16:12
|
||||
_9 = move (_5.1: &i32); // bb0[11]: scope 1 at $DIR/inline-closure-borrows-arg.rs:16:5: 16:12
|
||||
_0 = (*_8); // bb0[12]: scope 3 at $DIR/inline-closure-borrows-arg.rs:14:9: 14:18
|
||||
StorageDead(_7); // bb0[13]: scope 1 at $DIR/inline-closure-borrows-arg.rs:16:11: 16:12
|
||||
StorageDead(_6); // bb0[14]: scope 1 at $DIR/inline-closure-borrows-arg.rs:16:11: 16:12
|
||||
StorageDead(_5); // bb0[15]: scope 1 at $DIR/inline-closure-borrows-arg.rs:16:11: 16:12
|
||||
StorageDead(_4); // bb0[16]: scope 1 at $DIR/inline-closure-borrows-arg.rs:16:11: 16:12
|
||||
StorageDead(_3); // bb0[17]: scope 0 at $DIR/inline-closure-borrows-arg.rs:17:1: 17:2
|
||||
return; // bb0[18]: scope 0 at $DIR/inline-closure-borrows-arg.rs:17:2: 17:2
|
||||
}
|
||||
}
|
|
@ -6,55 +6,8 @@ fn main() {
|
|||
println!("{:?}", foo(0, 14));
|
||||
}
|
||||
|
||||
// EMIT_MIR rustc.foo.Inline.after.mir
|
||||
fn foo<T: Copy>(t: T, q: i32) -> (i32, T) {
|
||||
let x = |_q| (q, t);
|
||||
x(q)
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
// START rustc.foo.Inline.after.mir
|
||||
// fn foo(_1: T, _2: i32) -> (i32, T){
|
||||
// debug t => _1;
|
||||
// debug q => _2;
|
||||
// let mut _0: (i32, T);
|
||||
// let _3: [closure@foo<T>::{{closure}}#0 q:&i32, t:&T];
|
||||
// let mut _4: &i32;
|
||||
// let mut _5: &T;
|
||||
// let mut _6: &[closure@foo<T>::{{closure}}#0 q:&i32, t:&T];
|
||||
// let mut _7: (i32,);
|
||||
// let mut _8: i32;
|
||||
// let mut _11: i32;
|
||||
// scope 1 {
|
||||
// debug x => _3;
|
||||
// scope 2 {
|
||||
// debug _q => _11;
|
||||
// debug q => (*((*_6).0: &i32));
|
||||
// debug t => (*((*_6).1: &T));
|
||||
// let mut _9: i32;
|
||||
// let mut _10: T;
|
||||
// }
|
||||
// }
|
||||
// bb0: {
|
||||
// ...
|
||||
// _4 = &_2;
|
||||
// ...
|
||||
// _5 = &_1;
|
||||
// _3 = [closure@foo::<T>::{{closure}}#0] { q: move _4, t: move _5 };
|
||||
// ...
|
||||
// _6 = &_3;
|
||||
// ...
|
||||
// ...
|
||||
// _8 = _2;
|
||||
// _7 = (move _8,);
|
||||
// _11 = move (_7.0: i32);
|
||||
// ...
|
||||
// _9 = (*((*_6).0: &i32));
|
||||
// ...
|
||||
// _10 = (*((*_6).1: &T));
|
||||
// (_0.0: i32) = move _9;
|
||||
// (_0.1: T) = move _10;
|
||||
// ...
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// END rustc.foo.Inline.after.mir
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
// MIR for `foo` after Inline
|
||||
|
||||
fn foo(_1: T, _2: i32) -> (i32, T) {
|
||||
debug t => _1; // in scope 0 at $DIR/inline-closure-captures.rs:10:17: 10:18
|
||||
debug q => _2; // in scope 0 at $DIR/inline-closure-captures.rs:10:23: 10:24
|
||||
let mut _0: (i32, T); // return place in scope 0 at $DIR/inline-closure-captures.rs:10:34: 10:42
|
||||
let _3: [closure@foo<T>::{{closure}}#0 q:&i32, t:&T]; // in scope 0 at $DIR/inline-closure-captures.rs:11:9: 11:10
|
||||
let mut _4: &i32; // in scope 0 at $DIR/inline-closure-captures.rs:11:13: 11:24
|
||||
let mut _5: &T; // in scope 0 at $DIR/inline-closure-captures.rs:11:13: 11:24
|
||||
let mut _6: &[closure@foo<T>::{{closure}}#0 q:&i32, t:&T]; // in scope 0 at $DIR/inline-closure-captures.rs:12:5: 12:6
|
||||
let mut _7: (i32,); // in scope 0 at $DIR/inline-closure-captures.rs:12:5: 12:9
|
||||
let mut _8: i32; // in scope 0 at $DIR/inline-closure-captures.rs:12:7: 12:8
|
||||
let mut _11: i32; // in scope 0 at $DIR/inline-closure-captures.rs:12:5: 12:9
|
||||
scope 1 {
|
||||
debug x => _3; // in scope 1 at $DIR/inline-closure-captures.rs:11:9: 11:10
|
||||
scope 2 {
|
||||
debug _q => _11; // in scope 2 at $DIR/inline-closure-captures.rs:11:14: 11:16
|
||||
debug q => (*((*_6).0: &i32)); // in scope 2 at $DIR/inline-closure-captures.rs:10:23: 10:24
|
||||
debug t => (*((*_6).1: &T)); // in scope 2 at $DIR/inline-closure-captures.rs:10:17: 10:18
|
||||
let mut _9: i32; // in scope 2 at $DIR/inline-closure-captures.rs:12:5: 12:9
|
||||
let mut _10: T; // in scope 2 at $DIR/inline-closure-captures.rs:12:5: 12:9
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_3); // bb0[0]: scope 0 at $DIR/inline-closure-captures.rs:11:9: 11:10
|
||||
StorageLive(_4); // bb0[1]: scope 0 at $DIR/inline-closure-captures.rs:11:13: 11:24
|
||||
_4 = &_2; // bb0[2]: scope 0 at $DIR/inline-closure-captures.rs:11:13: 11:24
|
||||
StorageLive(_5); // bb0[3]: scope 0 at $DIR/inline-closure-captures.rs:11:13: 11:24
|
||||
_5 = &_1; // bb0[4]: scope 0 at $DIR/inline-closure-captures.rs:11:13: 11:24
|
||||
_3 = [closure@foo::<T>::{{closure}}#0] { q: move _4, t: move _5 }; // bb0[5]: scope 0 at $DIR/inline-closure-captures.rs:11:13: 11:24
|
||||
// closure
|
||||
// + def_id: DefId(0:6 ~ inline_closure_captures[317d]::foo[0]::{{closure}}[0])
|
||||
// + substs: [
|
||||
// T,
|
||||
// i8,
|
||||
// extern "rust-call" fn((i32,)) -> (i32, T),
|
||||
// (&i32, &T),
|
||||
// ]
|
||||
StorageDead(_5); // bb0[6]: scope 0 at $DIR/inline-closure-captures.rs:11:23: 11:24
|
||||
StorageDead(_4); // bb0[7]: scope 0 at $DIR/inline-closure-captures.rs:11:23: 11:24
|
||||
StorageLive(_6); // bb0[8]: scope 1 at $DIR/inline-closure-captures.rs:12:5: 12:6
|
||||
_6 = &_3; // bb0[9]: scope 1 at $DIR/inline-closure-captures.rs:12:5: 12:6
|
||||
StorageLive(_7); // bb0[10]: scope 1 at $DIR/inline-closure-captures.rs:12:5: 12:9
|
||||
StorageLive(_8); // bb0[11]: scope 1 at $DIR/inline-closure-captures.rs:12:7: 12:8
|
||||
_8 = _2; // bb0[12]: scope 1 at $DIR/inline-closure-captures.rs:12:7: 12:8
|
||||
_7 = (move _8,); // bb0[13]: scope 1 at $DIR/inline-closure-captures.rs:12:5: 12:9
|
||||
_11 = move (_7.0: i32); // bb0[14]: scope 1 at $DIR/inline-closure-captures.rs:12:5: 12:9
|
||||
StorageLive(_9); // bb0[15]: scope 2 at $DIR/inline-closure-captures.rs:11:19: 11:20
|
||||
_9 = (*((*_6).0: &i32)); // bb0[16]: scope 2 at $DIR/inline-closure-captures.rs:11:19: 11:20
|
||||
StorageLive(_10); // bb0[17]: scope 2 at $DIR/inline-closure-captures.rs:11:22: 11:23
|
||||
_10 = (*((*_6).1: &T)); // bb0[18]: scope 2 at $DIR/inline-closure-captures.rs:11:22: 11:23
|
||||
(_0.0: i32) = move _9; // bb0[19]: scope 2 at $DIR/inline-closure-captures.rs:11:18: 11:24
|
||||
(_0.1: T) = move _10; // bb0[20]: scope 2 at $DIR/inline-closure-captures.rs:11:18: 11:24
|
||||
StorageDead(_10); // bb0[21]: scope 2 at $DIR/inline-closure-captures.rs:11:23: 11:24
|
||||
StorageDead(_9); // bb0[22]: scope 2 at $DIR/inline-closure-captures.rs:11:23: 11:24
|
||||
StorageDead(_8); // bb0[23]: scope 1 at $DIR/inline-closure-captures.rs:12:8: 12:9
|
||||
StorageDead(_7); // bb0[24]: scope 1 at $DIR/inline-closure-captures.rs:12:8: 12:9
|
||||
StorageDead(_6); // bb0[25]: scope 1 at $DIR/inline-closure-captures.rs:12:8: 12:9
|
||||
StorageDead(_3); // bb0[26]: scope 0 at $DIR/inline-closure-captures.rs:13:1: 13:2
|
||||
return; // bb0[27]: scope 0 at $DIR/inline-closure-captures.rs:13:2: 13:2
|
||||
}
|
||||
}
|
|
@ -6,45 +6,8 @@ fn main() {
|
|||
println!("{}", foo(0, 14));
|
||||
}
|
||||
|
||||
// EMIT_MIR rustc.foo.Inline.after.mir
|
||||
fn foo<T: Copy>(_t: T, q: i32) -> i32 {
|
||||
let x = |_t, _q| _t;
|
||||
x(q, q)
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
// START rustc.foo.Inline.after.mir
|
||||
// fn foo(_1: T, _2: i32) -> i32{
|
||||
// debug _t => _1;
|
||||
// debug q => _2;
|
||||
// let mut _0: i32;
|
||||
// let _3: [closure@foo<T>::{{closure}}#0];
|
||||
// let mut _4: &[closure@foo<T>::{{closure}}#0];
|
||||
// let mut _5: (i32, i32);
|
||||
// let mut _6: i32;
|
||||
// let mut _7: i32;
|
||||
// let mut _8: i32;
|
||||
// let mut _9: i32;
|
||||
// scope 1 {
|
||||
// debug x => _3;
|
||||
// scope 2 {
|
||||
// debug _t => _8;
|
||||
// debug _q => _9;
|
||||
// }
|
||||
// }
|
||||
// bb0: {
|
||||
// ...
|
||||
// _3 = [closure@foo::<T>::{{closure}}#0];
|
||||
// ...
|
||||
// _4 = &_3;
|
||||
// ...
|
||||
// _6 = _2;
|
||||
// ...
|
||||
// _7 = _2;
|
||||
// _5 = (move _6, move _7);
|
||||
// _8 = move (_5.0: i32);
|
||||
// _9 = move (_5.1: i32);
|
||||
// _0 = _8;
|
||||
// ...
|
||||
// return;
|
||||
// }
|
||||
// END rustc.foo.Inline.after.mir
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
// MIR for `foo` after Inline
|
||||
|
||||
fn foo(_1: T, _2: i32) -> i32 {
|
||||
debug _t => _1; // in scope 0 at $DIR/inline-closure.rs:10:17: 10:19
|
||||
debug q => _2; // in scope 0 at $DIR/inline-closure.rs:10:24: 10:25
|
||||
let mut _0: i32; // return place in scope 0 at $DIR/inline-closure.rs:10:35: 10:38
|
||||
let _3: [closure@foo<T>::{{closure}}#0]; // in scope 0 at $DIR/inline-closure.rs:11:9: 11:10
|
||||
let mut _4: &[closure@foo<T>::{{closure}}#0]; // in scope 0 at $DIR/inline-closure.rs:12:5: 12:6
|
||||
let mut _5: (i32, i32); // in scope 0 at $DIR/inline-closure.rs:12:5: 12:12
|
||||
let mut _6: i32; // in scope 0 at $DIR/inline-closure.rs:12:7: 12:8
|
||||
let mut _7: i32; // in scope 0 at $DIR/inline-closure.rs:12:10: 12:11
|
||||
let mut _8: i32; // in scope 0 at $DIR/inline-closure.rs:12:5: 12:12
|
||||
let mut _9: i32; // in scope 0 at $DIR/inline-closure.rs:12:5: 12:12
|
||||
scope 1 {
|
||||
debug x => _3; // in scope 1 at $DIR/inline-closure.rs:11:9: 11:10
|
||||
scope 2 {
|
||||
debug _t => _8; // in scope 2 at $DIR/inline-closure.rs:11:14: 11:16
|
||||
debug _q => _9; // in scope 2 at $DIR/inline-closure.rs:11:18: 11:20
|
||||
}
|
||||
}
|
||||
|
||||
bb0: {
|
||||
StorageLive(_3); // bb0[0]: scope 0 at $DIR/inline-closure.rs:11:9: 11:10
|
||||
_3 = [closure@foo::<T>::{{closure}}#0]; // bb0[1]: scope 0 at $DIR/inline-closure.rs:11:13: 11:24
|
||||
// closure
|
||||
// + def_id: DefId(0:6 ~ inline_closure[317d]::foo[0]::{{closure}}[0])
|
||||
// + substs: [
|
||||
// T,
|
||||
// i8,
|
||||
// extern "rust-call" fn((i32, i32)) -> i32,
|
||||
// (),
|
||||
// ]
|
||||
StorageLive(_4); // bb0[2]: scope 1 at $DIR/inline-closure.rs:12:5: 12:6
|
||||
_4 = &_3; // bb0[3]: scope 1 at $DIR/inline-closure.rs:12:5: 12:6
|
||||
StorageLive(_5); // bb0[4]: scope 1 at $DIR/inline-closure.rs:12:5: 12:12
|
||||
StorageLive(_6); // bb0[5]: scope 1 at $DIR/inline-closure.rs:12:7: 12:8
|
||||
_6 = _2; // bb0[6]: scope 1 at $DIR/inline-closure.rs:12:7: 12:8
|
||||
StorageLive(_7); // bb0[7]: scope 1 at $DIR/inline-closure.rs:12:10: 12:11
|
||||
_7 = _2; // bb0[8]: scope 1 at $DIR/inline-closure.rs:12:10: 12:11
|
||||
_5 = (move _6, move _7); // bb0[9]: scope 1 at $DIR/inline-closure.rs:12:5: 12:12
|
||||
_8 = move (_5.0: i32); // bb0[10]: scope 1 at $DIR/inline-closure.rs:12:5: 12:12
|
||||
_9 = move (_5.1: i32); // bb0[11]: scope 1 at $DIR/inline-closure.rs:12:5: 12:12
|
||||
_0 = _8; // bb0[12]: scope 2 at $DIR/inline-closure.rs:11:22: 11:24
|
||||
StorageDead(_7); // bb0[13]: scope 1 at $DIR/inline-closure.rs:12:11: 12:12
|
||||
StorageDead(_6); // bb0[14]: scope 1 at $DIR/inline-closure.rs:12:11: 12:12
|
||||
StorageDead(_5); // bb0[15]: scope 1 at $DIR/inline-closure.rs:12:11: 12:12
|
||||
StorageDead(_4); // bb0[16]: scope 1 at $DIR/inline-closure.rs:12:11: 12:12
|
||||
StorageDead(_3); // bb0[17]: scope 0 at $DIR/inline-closure.rs:13:1: 13:2
|
||||
return; // bb0[18]: scope 0 at $DIR/inline-closure.rs:13:2: 13:2
|
||||
}
|
||||
}
|
|
@ -1,73 +1,9 @@
|
|||
// ignore-tidy-linelength
|
||||
// ignore-wasm32-bare compiled with panic=abort by default
|
||||
// compile-flags: -Z mir-opt-level=3
|
||||
// only-64bit FIXME: the mir representation of RawVec depends on ptr size
|
||||
#![feature(box_syntax)]
|
||||
|
||||
// EMIT_MIR rustc.main.Inline.diff
|
||||
fn main() {
|
||||
let _x: Box<Vec<u32>> = box Vec::new();
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
// START rustc.main.Inline.before.mir
|
||||
// let mut _0: ();
|
||||
// let _1: std::boxed::Box<std::vec::Vec<u32>> as UserTypeProjection { base: UserType(0), projs: [] };
|
||||
// let mut _2: std::boxed::Box<std::vec::Vec<u32>>;
|
||||
// let mut _3: ();
|
||||
// scope 1 {
|
||||
// debug _x => _1;
|
||||
// }
|
||||
// bb0: {
|
||||
// StorageLive(_1);
|
||||
// StorageLive(_2);
|
||||
// _2 = Box(std::vec::Vec<u32>);
|
||||
// (*_2) = const std::vec::Vec::<u32>::new() -> [return: bb2, unwind: bb4];
|
||||
// }
|
||||
// bb1 (cleanup): {
|
||||
// resume;
|
||||
// }
|
||||
// bb2: {
|
||||
// _1 = move _2;
|
||||
// StorageDead(_2);
|
||||
// _0 = ();
|
||||
// drop(_1) -> [return: bb3, unwind: bb1];
|
||||
// }
|
||||
// bb3: {
|
||||
// StorageDead(_1);
|
||||
// return;
|
||||
// }
|
||||
// bb4 (cleanup): {
|
||||
// _3 = const alloc::alloc::box_free::<std::vec::Vec<u32>>(move (_2.0: std::ptr::Unique<std::vec::Vec<u32>>)) -> bb1;
|
||||
// }
|
||||
// END rustc.main.Inline.before.mir
|
||||
// START rustc.main.Inline.after.mir
|
||||
// let mut _0: ();
|
||||
// let _1: std::boxed::Box<std::vec::Vec<u32>> as UserTypeProjection { base: UserType(0), projs: [] };
|
||||
// let mut _2: std::boxed::Box<std::vec::Vec<u32>>;
|
||||
// let mut _3: ();
|
||||
// let mut _4: &mut std::vec::Vec<u32>;
|
||||
// scope 1 {
|
||||
// debug _x => _1;
|
||||
// }
|
||||
// scope 2 {
|
||||
// }
|
||||
// bb0: {
|
||||
// StorageLive(_1);
|
||||
// StorageLive(_2);
|
||||
// _2 = Box(std::vec::Vec<u32>);
|
||||
// _4 = &mut (*_2);
|
||||
// ((*_4).0: alloc::raw_vec::RawVec<u32>) = const ByRef { alloc: Allocation { bytes: [4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [65535], len: Size { raw: 16 } }, size: Size { raw: 16 }, align: Align { pow2: 3 }, mutability: Not, extra: () }, offset: Size { raw: 0 } }: alloc::raw_vec::RawVec::<u32>;
|
||||
// ((*_4).1: usize) = const 0usize;
|
||||
// _1 = move _2;
|
||||
// StorageDead(_2);
|
||||
// _0 = ();
|
||||
// drop(_1) -> [return: bb2, unwind: bb1];
|
||||
// }
|
||||
// bb1 (cleanup): {
|
||||
// resume;
|
||||
// }
|
||||
// bb2: {
|
||||
// StorageDead(_1);
|
||||
// return;
|
||||
// }
|
||||
// END rustc.main.Inline.after.mir
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
- // MIR for `main` before Inline
|
||||
+ // MIR for `main` after Inline
|
||||
|
||||
fn main() -> () {
|
||||
let mut _0: (); // return place in scope 0 at $DIR/inline-into-box-place.rs:7:11: 7:11
|
||||
let _1: std::boxed::Box<std::vec::Vec<u32>> as UserTypeProjection { base: UserType(0), projs: [] }; // in scope 0 at $DIR/inline-into-box-place.rs:8:9: 8:11
|
||||
let mut _2: std::boxed::Box<std::vec::Vec<u32>>; // in scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43
|
||||
let mut _3: (); // in scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43
|
||||
+ let mut _4: &mut std::vec::Vec<u32>; // in scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43
|
||||
scope 1 {
|
||||
debug _x => _1; // in scope 1 at $DIR/inline-into-box-place.rs:8:9: 8:11
|
||||
}
|
||||
+ scope 2 {
|
||||
+ }
|
||||
|
||||
bb0: {
|
||||
StorageLive(_1); // bb0[0]: scope 0 at $DIR/inline-into-box-place.rs:8:9: 8:11
|
||||
StorageLive(_2); // bb0[1]: scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43
|
||||
_2 = Box(std::vec::Vec<u32>); // bb0[2]: scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43
|
||||
- (*_2) = const std::vec::Vec::<u32>::new() -> [return: bb2, unwind: bb4]; // bb0[3]: scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43
|
||||
+ _4 = &mut (*_2); // bb0[3]: scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43
|
||||
+ ((*_4).0: alloc::raw_vec::RawVec<u32>) = const ByRef { alloc: Allocation { bytes: [4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [65535], len: Size { raw: 16 } }, size: Size { raw: 16 }, align: Align { pow2: 3 }, mutability: Not, extra: () }, offset: Size { raw: 0 } }: alloc::raw_vec::RawVec::<u32>; // bb0[4]: scope 2 at $SRC_DIR/liballoc/vec.rs:LL:COL
|
||||
// ty::Const
|
||||
- // + ty: fn() -> std::vec::Vec<u32> {std::vec::Vec::<u32>::new}
|
||||
- // + val: Value(Scalar(<ZST>))
|
||||
+ // + ty: alloc::raw_vec::RawVec<u32>
|
||||
+ // + val: Value(ByRef { alloc: Allocation { bytes: [4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [65535], len: Size { raw: 16 } }, size: Size { raw: 16 }, align: Align { pow2: 3 }, mutability: Not, extra: () }, offset: Size { raw: 0 } })
|
||||
// mir::Constant
|
||||
- // + span: $DIR/inline-into-box-place.rs:8:33: 8:41
|
||||
- // + user_ty: UserType(1)
|
||||
- // + literal: Const { ty: fn() -> std::vec::Vec<u32> {std::vec::Vec::<u32>::new}, val: Value(Scalar(<ZST>)) }
|
||||
+ // + span: $SRC_DIR/liballoc/vec.rs:LL:COL
|
||||
+ // + user_ty: UserType(0)
|
||||
+ // + literal: Const { ty: alloc::raw_vec::RawVec<u32>, val: Value(ByRef { alloc: Allocation { bytes: [4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], relocations: Relocations(SortedMap { data: [] }), undef_mask: UndefMask { blocks: [65535], len: Size { raw: 16 } }, size: Size { raw: 16 }, align: Align { pow2: 3 }, mutability: Not, extra: () }, offset: Size { raw: 0 } }) }
|
||||
+ ((*_4).1: usize) = const 0usize; // bb0[5]: scope 2 at $SRC_DIR/liballoc/vec.rs:LL:COL
|
||||
+ // ty::Const
|
||||
+ // + ty: usize
|
||||
+ // + val: Value(Scalar(0x0000000000000000))
|
||||
+ // mir::Constant
|
||||
+ // + span: $SRC_DIR/liballoc/vec.rs:LL:COL
|
||||
+ // + literal: Const { ty: usize, val: Value(Scalar(0x0000000000000000)) }
|
||||
+ _1 = move _2; // bb0[6]: scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43
|
||||
+ StorageDead(_2); // bb0[7]: scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43
|
||||
+ _0 = (); // bb0[8]: scope 0 at $DIR/inline-into-box-place.rs:7:11: 9:2
|
||||
+ drop(_1) -> [return: bb2, unwind: bb1]; // bb0[9]: scope 0 at $DIR/inline-into-box-place.rs:9:1: 9:2
|
||||
}
|
||||
|
||||
bb1 (cleanup): {
|
||||
resume; // bb1[0]: scope 0 at $DIR/inline-into-box-place.rs:7:1: 9:2
|
||||
}
|
||||
|
||||
bb2: {
|
||||
- _1 = move _2; // bb2[0]: scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43
|
||||
- StorageDead(_2); // bb2[1]: scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43
|
||||
- _0 = (); // bb2[2]: scope 0 at $DIR/inline-into-box-place.rs:7:11: 9:2
|
||||
- drop(_1) -> [return: bb3, unwind: bb1]; // bb2[3]: scope 0 at $DIR/inline-into-box-place.rs:9:1: 9:2
|
||||
- }
|
||||
-
|
||||
- bb3: {
|
||||
- StorageDead(_1); // bb3[0]: scope 0 at $DIR/inline-into-box-place.rs:9:1: 9:2
|
||||
- return; // bb3[1]: scope 0 at $DIR/inline-into-box-place.rs:9:2: 9:2
|
||||
- }
|
||||
-
|
||||
- bb4 (cleanup): {
|
||||
- _3 = const alloc::alloc::box_free::<std::vec::Vec<u32>>(move (_2.0: std::ptr::Unique<std::vec::Vec<u32>>)) -> bb1; // bb4[0]: scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43
|
||||
- // ty::Const
|
||||
- // + ty: unsafe fn(std::ptr::Unique<std::vec::Vec<u32>>) {alloc::alloc::box_free::<std::vec::Vec<u32>>}
|
||||
- // + val: Value(Scalar(<ZST>))
|
||||
- // mir::Constant
|
||||
- // + span: $DIR/inline-into-box-place.rs:8:42: 8:43
|
||||
- // + literal: Const { ty: unsafe fn(std::ptr::Unique<std::vec::Vec<u32>>) {alloc::alloc::box_free::<std::vec::Vec<u32>>}, val: Value(Scalar(<ZST>)) }
|
||||
+ StorageDead(_1); // bb2[0]: scope 0 at $DIR/inline-into-box-place.rs:9:1: 9:2
|
||||
+ return; // bb2[1]: scope 0 at $DIR/inline-into-box-place.rs:9:2: 9:2
|
||||
}
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@ fn main() {
|
|||
println!("{}", bar());
|
||||
}
|
||||
|
||||
// EMIT_MIR rustc.bar.Inline.after.mir
|
||||
fn bar() -> bool {
|
||||
let f = foo;
|
||||
f(&1, &-1)
|
||||
|
@ -15,23 +16,3 @@ fn bar() -> bool {
|
|||
fn foo(x: &i32, y: &i32) -> bool {
|
||||
*x == *y
|
||||
}
|
||||
|
||||
// END RUST SOURCE
|
||||
// START rustc.bar.Inline.after.mir
|
||||
// ...
|
||||
// bb0: {
|
||||
// ...
|
||||
// Retag(_3);
|
||||
// ...
|
||||
// Retag(_3);
|
||||
// Retag(_6);
|
||||
// StorageLive(_11);
|
||||
// _11 = (*_3);
|
||||
// StorageLive(_12);
|
||||
// _12 = (*_6);
|
||||
// _0 = Eq(move _11, move _12);
|
||||
// ...
|
||||
// return;
|
||||
// }
|
||||
// ...
|
||||
// END rustc.bar.Inline.after.mir
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue