[Mesa-dev] [PATCH 00/12] i965/vec4: Better dead code elimination.

Eric Anholt eric at anholt.net
Thu Mar 20 12:35:55 PDT 2014


Matt Turner <mattst88 at gmail.com> writes:

> total instructions in shared programs: 811813 -> 788004 (-2.93%)
> instructions in affected programs:     185685 -> 161876 (-12.82%)
> (this is only the .shader_test files. Our .vert files are useless)
>
> This series improves the dead code elimination pass in i965
> vec4 backend. A small overview of the patches:
>
> i965/vec4: Add missing doxygen close brace.
> i965/vec4: Add and use vec4_instruction::writes_flag().
> i965/vec4: Rename depends_on_flags() to reads_flag().
> i965/vec4: Print the predicate in dump_instructions().
> i965/vec4: Add is_null() method to dst_reg.
> i965/vec4: Preparatory clean up of dead_code_eliminate().
>
>    Clean ups and preparations.
>
> i965/vec4: Don't dead code eliminate instructions
>
>    Remove the possibility of eliminating things that
>    weren't actually dead.
>
> i965/vec4: Track live ranges per-channel, not per vgrf.
> i965/vec4: Let dead code eliminate trim dead channels.
>
>    Perform dead code elimination on a per-channel basis.
>
> i965/vec4: Factor code out of DCE into a separate
> i965/vec4: Eliminate writes that are never read.
>
>    For each instruction, eliminate previous instructions
>    whose results this instruction overwrote before they
>    were read.
>
> i965/vec4: Eliminate dead writes to the flag register.
>
>    Same thing, but for the flag register.
>
> The dead code elimination pass still has some limitations
> and areas for improvement. I'm pretty sick of working on
> this, so I'm not planning to do it anytime soon. Ideas:
>
>  - Extend the pass to eliminate overwritten results in all
>    basic blocks (currently we only do it in the first block)
>  - Search instructions backwards, so that when we eliminate
>    dead writes we don't have to consider them again.
>  - Stop scanning backwards if we hit the beginning of the
>    destination's live range.

Yeah, a real dataflow analysis based DCE would be pretty cool, but this
is a lot better than before.  This series is:

Reviewed-by: Eric Anholt <eric at anholt.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140320/ca9c9304/attachment.sig>


More information about the mesa-dev mailing list