[Mesa-dev] [PATCH] glsl: Add an optimization pass to flatten simple nested if blocks.
Matt Turner
mattst88 at gmail.com
Thu Apr 4 10:44:33 PDT 2013
On Wed, Apr 3, 2013 at 11:56 PM, Kenneth Graunke <kenneth at whitecape.org>wrote:
> GLBenchmark 2.7's shaders contain conditional blocks like:
>
> if (x) {
> if (y) {
> ...
> }
> }
>
> where the outer conditional's then clause contains exactly one statement
> (the nested if) and there are no else clauses. This can easily be
> optimized into:
>
> if (x && y) {
> ...
> }
>
> This saves a few instructions in GLBenchmark 2.7:
>
> total instructions in shared programs: 11833 -> 11649 (-1.55%)
> instructions in affected programs: 8234 -> 8050 (-2.23%)
>
> It also helps CS:GO slightly (-0.05%/-0.22%). More importantly,
> however, it simplifies the control flow graph, which could enable other
> optimizations.
>
> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
>
Reviewed-by: Matt Turner <mattst88 at gmail.com>
Any measurable performance improvement?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130404/38477f93/attachment.html>
More information about the mesa-dev
mailing list