Potential bug in dominance
The following Juno code produces an error when compiled:
fn test(x: i32, y: f32) -> (i32, f32) {
let res = (x, y);
for i = 0 to 10 {
if i % 2 == 0 {
res.0 += 1;
} else {
res.1 *= 2.0;
}
}
return res;
}
Error Message:
thread 'main' panicked at hercules_ir/src/dom.rs:135:17:
In DomChainIterator, top node (NodeID(33)) doesn't dominate bottom node (NodeID(10)).
From debugging, this appears to occur after the forkify pass. By adding two xdot passes following forkify, the first with the argument as false and the second with it as true, we can see that the code from Forkify appears valid, but when constructing basic blocks for the second xdot pass we get the above error.