nak/spill_values: Spill constants across edges if needed

In a previous iteration of the spilling code, we added an extra check to
only spill across edges if the value being spilled is in the W set.
This was due to a misunderstanding of the modeling of S and W in Braun
and Hack.  In the current implementation, we maintain the invariant that
every live value is in at least one of S or W so we don't need that
check but it was left in by mistake.

One exception to this rule was added when we special-cased constant
values.  Now the invariant is that every live value is in S, in W, or is
a constant.  When we made this change, the check we accidentally left in
bit us because now if a value is constant but not in W, it wasn't
getting spilled across the edge.  This can result in a value getting
filled later which was never spilled, leading to undefined values.

Fixes: 7b82e26e3c ("nak: Don't spill/fill const values")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12993
Co-authored-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34563>
This commit is contained in:
Mel Henning 2025-04-16 18:07:03 -04:00 committed by Marge Bot
parent 8744c98fa9
commit de1ed48325

View file

@ -1003,7 +1003,8 @@ fn spill_values<S: Spill>(
}
for ssa in s_in.s.iter() {
if p_out.w.contains(ssa) && !p_out.s.contains(ssa) {
if !p_out.s.contains(ssa) {
assert!(p_out.w.contains(ssa) || spill.is_const(ssa));
spills.push(*ssa);
}
}