Skip to content

Commit

Permalink
FileCheck discriminant.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjgillot committed Dec 2, 2023
1 parent 043d29b commit bf5d114
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions tests/mir-opt/const_prop/discriminant.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// skip-filecheck
// unit-test: ConstProp
// compile-flags: -O

// FIXME(wesleywiser): Ideally, we could const-prop away all of this and just be left with
// `let x = 42` but that doesn't work because const-prop doesn't support `Operand::Indirect`
Expand All @@ -10,5 +8,18 @@
// EMIT_MIR_FOR_EACH_BIT_WIDTH
// EMIT_MIR discriminant.main.ConstProp.diff
fn main() {
// CHECK-LABEL: fn main(
// CHECK: bb0: {
// CHECK: switchInt(const 1_isize) -> [1: bb1, otherwise: bb3];
// CHECK: bb1: {
// CHECK: switchInt(const true) -> [0: bb3, otherwise: bb2];
// CHECK: bb2: {
// CHECK: [[tmp:_.*]] = const 42_i32;
// CHECK: goto -> bb4;
// CHECK: bb3: {
// CHECK: [[tmp]] = const 10_i32;
// CHECK: goto -> bb4;
// CHECK: bb4: {
// CHECK: {{_.*}} = Add(move [[tmp]], const 0_i32);
let x = (if let Some(true) = Some(true) { 42 } else { 10 }) + 0;
}

0 comments on commit bf5d114

Please sign in to comment.