-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Expand file tree
/
Copy pathnon_dominate.rs
More file actions
43 lines (39 loc) · 914 Bytes
/
non_dominate.rs
File metadata and controls
43 lines (39 loc) · 914 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//@ test-mir-pass: CopyProp
#![feature(custom_mir, core_intrinsics)]
#![allow(unused_assignments)]
extern crate core;
use core::intrinsics::mir::*;
#[custom_mir(dialect = "analysis", phase = "post-cleanup")]
fn f(c: bool) -> bool {
// CHECK-LABEL: fn f(
// CHECK: bb2: {
// CHECK: _2 = copy _3;
// CHECK: bb3: {
// CHECK: _0 = copy _2;
mir! {
let a: bool;
let b: bool;
{
Goto(bb1)
}
bb1 = {
b = c;
match b { false => bb3, _ => bb2 }
}
// This assignment to `a` does not dominate the use in `bb3`.
// It should not be replaced by `b`.
bb2 = {
a = b;
c = false;
Goto(bb1)
}
bb3 = {
RET = a;
Return()
}
}
}
fn main() {
assert_eq!(true, f(true));
}
// EMIT_MIR non_dominate.f.CopyProp.diff