summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/loop_analysis.h
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-09-05 15:59:07 +1000
committerTimothy Arceri <[email protected]>2017-10-10 10:05:37 +1100
commitab23b759f241a4e2247efa28bd28a5f20149c70b (patch)
tree949b51f7e99fb7eec1116ebea4eabc8746cbb283 /src/compiler/glsl/loop_analysis.h
parentc63ce5c95d03f300be4a0f4b09e1d0cbc90e554e (diff)
glsl: don't drop instructions from unreachable terminators continue branch
These instructions will be executed on every iteration of the loop we cannot drop them. V2: - move removal of unreachable terminators from the terminator list to the same place they are removed from the IR as suggested by Nicolai. Reviewed-by: Nicolai Hähnle <[email protected]> Tested-by: Dieter Nützel <[email protected]>
Diffstat (limited to 'src/compiler/glsl/loop_analysis.h')
-rw-r--r--src/compiler/glsl/loop_analysis.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/compiler/glsl/loop_analysis.h b/src/compiler/glsl/loop_analysis.h
index 8f824046945..99b6bf75638 100644
--- a/src/compiler/glsl/loop_analysis.h
+++ b/src/compiler/glsl/loop_analysis.h
@@ -34,6 +34,13 @@
extern class loop_state *
analyze_loop_variables(exec_list *instructions);
+static inline bool
+is_break(ir_instruction *ir)
+{
+ return ir != NULL && ir->ir_type == ir_type_loop_jump &&
+ ((ir_loop_jump *) ir)->is_break();
+}
+
extern bool
unroll_loops(exec_list *instructions, loop_state *ls,