mirror of
https://github.com/EmbarkStudios/rust-gpu.git
synced 2024-11-21 22:34:34 +00:00
spirt_passes/reduce: fix long-standing bug involving chained replacements.
This commit is contained in:
parent
7f508ba86c
commit
b3670b2303
@ -235,15 +235,23 @@ pub(crate) fn reduce_in_func(cx: &Context, func_def_body: &mut FuncDefBody) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
func_def_body.inner_in_place_transform_with(&mut ReplaceValueWith(|v| match v {
|
func_def_body.inner_in_place_transform_with(&mut ReplaceValueWith(|mut v| {
|
||||||
Value::Const(_) => None,
|
let old = v;
|
||||||
_ => value_replacements
|
loop {
|
||||||
.get(&HashableValue(v))
|
match v {
|
||||||
.copied()
|
Value::Const(_) => break,
|
||||||
.map(|new| {
|
_ => match value_replacements.get(&HashableValue(v)) {
|
||||||
any_changes = true;
|
Some(&new) => v = new,
|
||||||
new
|
None => break,
|
||||||
}),
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if v != old {
|
||||||
|
any_changes = true;
|
||||||
|
Some(v)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user