pan/bi: Dead code eliminate per-channel

We already track the full liveness so this is a trivial optimization,
with an especial win for shaders reading only a subset of components of
gl_FragCoord.

More importantly, it's required for proper scheduling (in soft mode)
when vectors are used and some (but not all components) are promoted to
temporary registers.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8354>
This commit is contained in:
Alyssa Rosenzweig 2021-02-05 17:58:46 -05:00 committed by Marge Bot
parent 08d98290fe
commit b8f042c9bb

View file

@ -46,8 +46,9 @@ bi_opt_dead_code_eliminate(bi_context *ctx, bi_block *block, bool soft)
bi_foreach_instr_in_block_safe_rev(block, ins) {
unsigned index = bi_get_node(ins->dest[0]);
bool index_live = (live[index] & bi_writemask(ins));
if (index < temp_count && !live[index]) {
if (index < temp_count && !index_live) {
if (soft || bi_side_effects(ins->op))
ins->dest[0] = bi_null();
else