Change ZeroOneOrMore::Zero() to TableElementType::Zero.

This commit is contained in:
Dan Gohman
2018-12-06 09:36:48 -05:00
parent 42e35c4c57
commit 76583192a8

View File

@@ -192,9 +192,9 @@ impl SSABuilder {
/// Small enum used for clarity in some functions.
#[derive(Debug)]
enum ZeroOneOrMore<T> {
Zero(),
Zero,
One(T),
More(),
More,
}
#[derive(Debug)]
@@ -526,7 +526,7 @@ impl SSABuilder {
temp_arg_var: Variable,
dest_ebb: Ebb,
) {
let mut pred_values: ZeroOneOrMore<Value> = ZeroOneOrMore::Zero();
let mut pred_values: ZeroOneOrMore<Value> = ZeroOneOrMore::Zero;
// Iterate over the predecessors.
for _ in 0..self.predecessors(dest_ebb).len() {
@@ -534,21 +534,21 @@ impl SSABuilder {
// to var and we put it as an argument of the branch instruction.
let pred_val = self.results.pop().unwrap();
match pred_values {
ZeroOneOrMore::Zero() => {
ZeroOneOrMore::Zero => {
if pred_val != temp_arg_val {
pred_values = ZeroOneOrMore::One(pred_val);
}
}
ZeroOneOrMore::One(old_val) => {
if pred_val != temp_arg_val && pred_val != old_val {
pred_values = ZeroOneOrMore::More();
pred_values = ZeroOneOrMore::More;
}
}
ZeroOneOrMore::More() => {}
ZeroOneOrMore::More => {}
}
}
let result_val = match pred_values {
ZeroOneOrMore::Zero() => {
ZeroOneOrMore::Zero => {
// The variable is used but never defined before. This is an irregularity in the
// code, but rather than throwing an error we silently initialize the variable to
// 0. This will have no effect since this situation happens in unreachable code.
@@ -583,7 +583,7 @@ impl SSABuilder {
func.dfg.change_to_alias(temp_arg_val, resolved);
resolved
}
ZeroOneOrMore::More() => {
ZeroOneOrMore::More => {
// There is disagreement in the predecessors on which value to use so we have
// to keep the ebb argument. To avoid borrowing `self` for the whole loop,
// temporarily detach the predecessors list and replace it with an empty list.