From 728bd3ad79ef0d4a2380c69b10e2d39e013d30e0 Mon Sep 17 00:00:00 2001 From: Simon Perretta Date: Sun, 6 Apr 2025 13:45:58 +0100 Subject: [PATCH] pco: ensure srcs/dests interfere for instructions with repeat > 1 Signed-off-by: Simon Perretta Acked-by: Erik Faye-Lund Part-of: --- src/imagination/pco/pco_ra.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/imagination/pco/pco_ra.c b/src/imagination/pco/pco_ra.c index df51aec3389..31819904a7a 100644 --- a/src/imagination/pco/pco_ra.c +++ b/src/imagination/pco/pco_ra.c @@ -627,6 +627,21 @@ static bool pco_ra_func(pco_func *func, } } + /* Make srcs and dests interfere for instructions with repeat > 1. */ + pco_foreach_instr_in_func_rev (instr, func) { + if (!pco_instr_has_rpt(instr)) + continue; + + if (pco_instr_get_rpt(instr) < 2) + continue; + + pco_foreach_instr_dest_ssa (pdest, instr) { + pco_foreach_instr_src_ssa (psrc, instr) { + ra_add_node_interference(ra_graph, pdest->val, psrc->val); + } + } + } + bool allocated = ra_allocate(ra_graph); assert(allocated); /* TODO: spilling. */