mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-10 16:50:13 +01:00
aco: use dominance helpers
This makes the passes slightly faster. Signed-off-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-by: Daniel Schürmann <daniel@schuermann.dev> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30440>
This commit is contained in:
parent
d91e634c13
commit
d81d5b7d00
2 changed files with 13 additions and 8 deletions
|
|
@ -146,14 +146,12 @@ inline bool
|
|||
dominates(cssa_ctx& ctx, Temp a, Temp b)
|
||||
{
|
||||
assert(defined_after(ctx, b, a));
|
||||
merge_node& node_a = ctx.merge_node_table[a.id()];
|
||||
merge_node& node_b = ctx.merge_node_table[b.id()];
|
||||
unsigned idom = node_b.defined_at;
|
||||
while (idom > node_a.defined_at)
|
||||
idom = b.regClass().type() == RegType::vgpr ? ctx.program->blocks[idom].logical_idom
|
||||
: ctx.program->blocks[idom].linear_idom;
|
||||
|
||||
return idom == node_a.defined_at;
|
||||
Block& parent = ctx.program->blocks[ctx.merge_node_table[a.id()].defined_at];
|
||||
Block& child = ctx.program->blocks[ctx.merge_node_table[b.id()].defined_at];
|
||||
if (b.regClass().type() == RegType::vgpr)
|
||||
return dominates_logical(parent, child);
|
||||
else
|
||||
return dominates_linear(parent, child);
|
||||
}
|
||||
|
||||
/* Checks whether some variable is live-out, not considering any phi-uses. */
|
||||
|
|
|
|||
|
|
@ -263,6 +263,13 @@ struct vn_ctx {
|
|||
bool
|
||||
dominates(vn_ctx& ctx, uint32_t parent, uint32_t child)
|
||||
{
|
||||
Block& parent_b = ctx.program->blocks[parent];
|
||||
Block& child_b = ctx.program->blocks[child];
|
||||
if (!dominates_logical(parent_b, child_b) || parent_b.loop_nest_depth > child_b.loop_nest_depth)
|
||||
return false;
|
||||
if (parent_b.loop_nest_depth == child_b.loop_nest_depth && parent_b.loop_nest_depth == 0)
|
||||
return true;
|
||||
|
||||
unsigned parent_loop_nest_depth = ctx.program->blocks[parent].loop_nest_depth;
|
||||
while (parent < child && parent_loop_nest_depth <= ctx.program->blocks[child].loop_nest_depth)
|
||||
child = ctx.program->blocks[child].logical_idom;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue