From 30f51f1a1a70bc838d5bed449daff0dd9f2e8ef2 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 22 Oct 2014 20:48:21 -0700 Subject: glsl: Optimize "if (cond) discard;" to a conditional discard. st_glsl_to_tgsi and ir_to_mesa have handled conditional discards for a long time; the previous patch added that capability to i965. i965 (Haswell) shader-db stats: Without NIR: total instructions in shared programs: 5792133 -> 5776360 (-0.27%) instructions in affected programs: 737585 -> 721812 (-2.14%) helped: 6300 HURT: 68 GAINED: 2 With NIR: total instructions in shared programs: 5787538 -> 5769569 (-0.31%) instructions in affected programs: 767843 -> 749874 (-2.34%) helped: 6522 HURT: 35 GAINED: 6 Signed-off-by: Kenneth Graunke Reviewed-by: Connor Abbott Reviewed-by: Matt Turner Reviewed-by: Eric Anholt --- src/glsl/glsl_parser_extras.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/glsl/glsl_parser_extras.cpp') diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp index 9f793138009..f19804b7238 100644 --- a/src/glsl/glsl_parser_extras.cpp +++ b/src/glsl/glsl_parser_extras.cpp @@ -1627,6 +1627,7 @@ do_common_optimization(exec_list *ir, bool linked, } progress = do_if_simplification(ir) || progress; progress = opt_flatten_nested_if_blocks(ir) || progress; + progress = opt_conditional_discard(ir) || progress; progress = do_copy_propagation(ir) || progress; progress = do_copy_propagation_elements(ir) || progress; -- cgit v1.2.3