Closed
Description
In MIR we want tmp*
values to be SSA, however ensuring that constraint in trans (i.e. in TempRef) is wrong, I think.
Namely, for code like this:
#![feature(rustc_attrs)]
struct A(f32);
#[rustc_mir(graphviz="mir.gv")]
fn mir(f: f32) -> bool { !(f.is_nan() || f.is_infinite()) }
fn main() { println!("{:?}", mir(0.0)); }
we will generate following MIR (graphviz version, because easier to visualise):
which will result in
test.rs:17:7: 17:36 error: internal compiler error: operand const false already assigned
test.rs:17 !(f.is_nan() || f.is_infinite())
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Note how we assign tmp0
twice, but the two branches are fully disjoint, and thus, for the purposes of data-flow tmp0
is still SSA, but for the purposes of translator tmp0
is assigned multiple times.
If we want TempRef
s to stay SSA
across translation of the whole function, we will need something like a phi
in the MIR.