Add FileCheck for if.rs, inherit_overflow.rs, issue_81605.rs
This commit is contained in:
parent
33e5d851a9
commit
24aefa0e5d
@ -1,12 +1,28 @@
|
|||||||
// skip-filecheck
|
|
||||||
// unit-test: DataflowConstProp
|
// unit-test: DataflowConstProp
|
||||||
|
|
||||||
// EMIT_MIR if.main.DataflowConstProp.diff
|
// EMIT_MIR if.main.DataflowConstProp.diff
|
||||||
|
// CHECK-LABEL: fn main(
|
||||||
fn main() {
|
fn main() {
|
||||||
|
// CHECK: debug b => [[b:_.*]];
|
||||||
|
// CHECK: debug c => [[c:_.*]];
|
||||||
|
// CHECK: debug d => [[d:_.*]];
|
||||||
|
// CHECK: debug e => [[e:_.*]];
|
||||||
|
|
||||||
let a = 1;
|
let a = 1;
|
||||||
|
|
||||||
|
// CHECK: switchInt(const true) -> [0: {{bb[0-9]+}}, otherwise: [[bb_first_true:bb[0-9]+]]];
|
||||||
|
// CHECK: [[bb_first_true]]: {
|
||||||
|
// CHECK: [[b]] = const 2_i32;
|
||||||
let b = if a == 1 { 2 } else { 3 };
|
let b = if a == 1 { 2 } else { 3 };
|
||||||
|
|
||||||
|
// CHECK: [[c]] = const 3_i32;
|
||||||
let c = b + 1;
|
let c = b + 1;
|
||||||
|
|
||||||
|
// CHECK: switchInt(const true) -> [0: {{bb[0-9]+}}, otherwise: [[bb_second_true:bb[0-9]+]]];
|
||||||
|
// CHECK: [[bb_second_true]]: {
|
||||||
|
// CHECK: [[d]] = const 1_i32;
|
||||||
let d = if a == 1 { a } else { a + 1 };
|
let d = if a == 1 { a } else { a + 1 };
|
||||||
|
|
||||||
|
// CHECK: [[e]] = const 2_i32;
|
||||||
let e = d + 1;
|
let e = d + 1;
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
// skip-filecheck
|
|
||||||
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
||||||
// unit-test: DataflowConstProp
|
// unit-test: DataflowConstProp
|
||||||
// compile-flags: -Zmir-enable-passes=+Inline
|
// compile-flags: -Zmir-enable-passes=+Inline
|
||||||
|
|
||||||
// EMIT_MIR inherit_overflow.main.DataflowConstProp.diff
|
// EMIT_MIR inherit_overflow.main.DataflowConstProp.diff
|
||||||
|
// CHECK-LABEL: fn main(
|
||||||
fn main() {
|
fn main() {
|
||||||
// After inlining, this will contain a `CheckedBinaryOp`.
|
// After inlining, this will contain a `CheckedBinaryOp`.
|
||||||
// Propagating the overflow is ok as codegen will just skip emitting the panic.
|
// Propagating the overflow is ok as codegen will just skip emitting the panic.
|
||||||
|
|
||||||
|
// CHECK: {{_.*}} = const (0_u8, true);
|
||||||
|
// CHECK-LABEL: assert(!const true,
|
||||||
let _ = <u8 as std::ops::Add>::add(255, 1);
|
let _ = <u8 as std::ops::Add>::add(255, 1);
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
// skip-filecheck
|
|
||||||
// unit-test: DataflowConstProp
|
// unit-test: DataflowConstProp
|
||||||
|
|
||||||
// EMIT_MIR issue_81605.f.DataflowConstProp.diff
|
// EMIT_MIR issue_81605.f.DataflowConstProp.diff
|
||||||
|
|
||||||
|
// CHECK-LABEL: fn f
|
||||||
fn f() -> usize {
|
fn f() -> usize {
|
||||||
|
// CHECK: switchInt(const true) -> [0: {{bb[0-9]+}}, otherwise: {{bb[0-9]+}}];
|
||||||
1 + if true { 1 } else { 2 }
|
1 + if true { 1 } else { 2 }
|
||||||
|
// CHECK: _0 = const 2_usize;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
Loading…
Reference in New Issue
Block a user