Skip to content

Commit d1bd1be

Browse files
committed
Use EMIT_MIR_FOR_EACH_BIT_WIDTH in transmute mir-opt test
1 parent 4adb8fb commit d1bd1be

21 files changed

+217
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
- // MIR for `from_char` before ConstProp
2+
+ // MIR for `from_char` after ConstProp
3+
4+
fn from_char() -> i32 {
5+
let mut _0: i32; // return place in scope 0 at $DIR/transmute.rs:+0:23: +0:26
6+
scope 1 {
7+
}
8+
9+
bb0: {
10+
- _0 = const 'R' as i32 (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:28
11+
+ _0 = const 82_i32; // scope 1 at $DIR/transmute.rs:+1:14: +1:28
12+
return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2
13+
}
14+
}
15+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
- // MIR for `invalid_bool` before ConstProp
2+
+ // MIR for `invalid_bool` after ConstProp
3+
4+
fn invalid_bool() -> bool {
5+
let mut _0: bool; // return place in scope 0 at $DIR/transmute.rs:+0:33: +0:37
6+
scope 1 {
7+
}
8+
9+
bb0: {
10+
- _0 = const -1_i8 as bool (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:30
11+
+ _0 = const {transmute(0xff): bool}; // scope 1 at $DIR/transmute.rs:+1:14: +1:30
12+
return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2
13+
}
14+
}
15+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
- // MIR for `invalid_char` before ConstProp
2+
+ // MIR for `invalid_char` after ConstProp
3+
4+
fn invalid_char() -> char {
5+
let mut _0: char; // return place in scope 0 at $DIR/transmute.rs:+0:33: +0:37
6+
scope 1 {
7+
}
8+
9+
bb0: {
10+
- _0 = const _ as char (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:33
11+
+ _0 = const {transmute(0x7fffffff): char}; // scope 1 at $DIR/transmute.rs:+1:14: +1:33
12+
return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2
13+
}
14+
}
15+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
- // MIR for `less_as_i8` before ConstProp
2+
+ // MIR for `less_as_i8` after ConstProp
3+
4+
fn less_as_i8() -> i8 {
5+
let mut _0: i8; // return place in scope 0 at $DIR/transmute.rs:+0:24: +0:26
6+
let mut _1: std::cmp::Ordering; // in scope 0 at $DIR/transmute.rs:+1:24: +1:48
7+
scope 1 {
8+
}
9+
10+
bb0: {
11+
StorageLive(_1); // scope 1 at $DIR/transmute.rs:+1:24: +1:48
12+
- _1 = Less; // scope 1 at $DIR/transmute.rs:+1:24: +1:48
13+
- _0 = move _1 as i8 (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:49
14+
+ _1 = const Less; // scope 1 at $DIR/transmute.rs:+1:24: +1:48
15+
+ // mir::Constant
16+
+ // + span: no-location
17+
+ // + literal: Const { ty: std::cmp::Ordering, val: Value(Scalar(0xff)) }
18+
+ _0 = const -1_i8; // scope 1 at $DIR/transmute.rs:+1:14: +1:49
19+
StorageDead(_1); // scope 1 at $DIR/transmute.rs:+1:48: +1:49
20+
return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2
21+
}
22+
}
23+

tests/mir-opt/const_prop/transmute.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// unit-test: ConstProp
22
// compile-flags: -O --crate-type=lib
3+
// ignore-endian-big
4+
// EMIT_MIR_FOR_EACH_BIT_WIDTH
35

46
use std::mem::transmute;
57

0 commit comments

Comments
 (0)