nak/to_cssa: Resolve phi register file mismatches

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29591>
This commit is contained in:
Faith Ekstrand
2024-05-30 16:52:02 -05:00
committed by Marge Bot
parent 1ed59706ea
commit 1334cf8fca
+26 -23
View File
@@ -355,31 +355,34 @@ impl Function {
debug_assert!(src.src_mod.is_none());
if let SrcRef::SSA(vec) = &src.src_ref {
debug_assert!(vec.comps() == 1);
let ss = cg.ssa_set(&vec[0]);
if cg.sets_interfere(ps, ss, &self.blocks) {
let tmp = self.ssa_alloc.alloc(file);
pcopy.push(tmp.into(), *src);
*src = tmp.into();
} else {
cg.sets_merge(ps, ss);
if vec[0].file() == file {
let ss = cg.ssa_set(&vec[0]);
if cg.sets_interfere(ps, ss, &self.blocks) {
let tmp = self.ssa_alloc.alloc(file);
pcopy.push(tmp.into(), *src);
*src = tmp.into();
} else {
cg.sets_merge(ps, ss);
}
continue;
}
} else {
// Non-SSA sources get an actual Mov instruction
// and are not considered part of the parallel
// copy.
let tmp = self.ssa_alloc.alloc(file);
if DEBUG.annotate() {
instrs.push(Instr::new_boxed(OpAnnotate {
annotation: "generated by to_cssa"
.into(),
}));
}
instrs.push(Instr::new_boxed(OpCopy {
dst: tmp.into(),
src: *src,
}));
*src = tmp.into();
}
// Non-SSA sources or sources with a different file
// from the destination get an actual copy
// instruction and are not considered part of the
// parallel copy.
let tmp = self.ssa_alloc.alloc(file);
if DEBUG.annotate() {
instrs.push(Instr::new_boxed(OpAnnotate {
annotation: "generated by to_cssa".into(),
}));
}
instrs.push(Instr::new_boxed(OpCopy {
dst: tmp.into(),
src: *src,
}));
*src = tmp.into();
}
if !pcopy.is_empty() {