about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2023-12-02 20:28:33 +0000
committerCamille GILLOT <gillot.camille@gmail.com>2023-12-02 20:28:33 +0000
commitbf5d114da8a376ee71ea68a6d7f9a5c2e6c4d302 (patch)
tree360042e125ea586653ccba12296c2454a80bff0a
parent043d29b58ae4eee0681b1724ed0c20d9ee3ed9e7 (diff)
downloadrust-bf5d114da8a376ee71ea68a6d7f9a5c2e6c4d302.tar.gz
rust-bf5d114da8a376ee71ea68a6d7f9a5c2e6c4d302.zip
FileCheck discriminant.
-rw-r--r--tests/mir-opt/const_prop/discriminant.rs15
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/mir-opt/const_prop/discriminant.rs b/tests/mir-opt/const_prop/discriminant.rs
index 11405f38bdc..0ed683d629c 100644
--- a/tests/mir-opt/const_prop/discriminant.rs
+++ b/tests/mir-opt/const_prop/discriminant.rs
@@ -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`
@@ -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;
 }