[Mesa-dev] [RFC PATCH 10/10] glsl/loops: Get rid of lower_bounded_loops and ir_loop::normative_bound.
Paul Berry
stereotype441 at gmail.com
Sat Nov 30 08:38:19 PST 2013
Now that loop_controls no longer creates normatively bound loops,
there is no need for ir_loop::normative_bound or the
lower_bounded_loops pass.
---
src/glsl/Makefile.sources | 1 -
src/glsl/ir.cpp | 1 -
src/glsl/ir.h | 7 --
src/glsl/ir_clone.cpp | 2 -
src/glsl/ir_optimization.h | 1 -
src/glsl/ir_print_visitor.cpp | 5 +-
src/glsl/ir_reader.cpp | 24 +----
src/glsl/loop_controls.cpp | 9 +-
src/glsl/loop_unroll.cpp | 3 -
src/glsl/lower_bounded_loops.cpp | 117 ---------------------
src/glsl/tests/lower_jumps/lower_breaks_1.opt_test | 2 +-
.../lower_jumps/lower_breaks_1.opt_test.expected | 2 +-
src/glsl/tests/lower_jumps/lower_breaks_2.opt_test | 2 +-
.../lower_jumps/lower_breaks_2.opt_test.expected | 2 +-
src/glsl/tests/lower_jumps/lower_breaks_3.opt_test | 2 +-
.../lower_jumps/lower_breaks_3.opt_test.expected | 2 +-
src/glsl/tests/lower_jumps/lower_breaks_4.opt_test | 2 +-
.../lower_jumps/lower_breaks_4.opt_test.expected | 2 +-
src/glsl/tests/lower_jumps/lower_breaks_5.opt_test | 2 +-
.../lower_jumps/lower_breaks_5.opt_test.expected | 2 +-
src/glsl/tests/lower_jumps/lower_breaks_6.opt_test | 2 +-
.../lower_jumps/lower_breaks_6.opt_test.expected | 2 +-
.../lower_guarded_conditional_break.opt_test | 2 +-
...wer_guarded_conditional_break.opt_test.expected | 2 +-
.../lower_jumps/lower_pulled_out_jump.opt_test | 2 +-
.../lower_pulled_out_jump.opt_test.expected | 2 +-
.../remove_continue_at_end_of_loop.opt_test | 2 +-
...emove_continue_at_end_of_loop.opt_test.expected | 2 +-
..._non_void_at_end_of_loop_lower_nothing.opt_test | 2 +-
..._at_end_of_loop_lower_nothing.opt_test.expected | 2 +-
...n_non_void_at_end_of_loop_lower_return.opt_test | 2 +-
...d_at_end_of_loop_lower_return.opt_test.expected | 2 +-
..._at_end_of_loop_lower_return_and_break.opt_test | 2 +-
...f_loop_lower_return_and_break.opt_test.expected | 2 +-
...turn_void_at_end_of_loop_lower_nothing.opt_test | 2 +-
..._at_end_of_loop_lower_nothing.opt_test.expected | 2 +-
...eturn_void_at_end_of_loop_lower_return.opt_test | 2 +-
...d_at_end_of_loop_lower_return.opt_test.expected | 2 +-
..._at_end_of_loop_lower_return_and_break.opt_test | 2 +-
...f_loop_lower_return_and_break.opt_test.expected | 2 +-
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 5 -
src/mesa/drivers/dri/i965/brw_shader.cpp | 2 -
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 5 -
src/mesa/program/ir_to_mesa.cpp | 7 --
src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 7 --
45 files changed, 35 insertions(+), 221 deletions(-)
delete mode 100644 src/glsl/lower_bounded_loops.cpp
diff --git a/src/glsl/Makefile.sources b/src/glsl/Makefile.sources
index 724c7b4..2e81ded 100644
--- a/src/glsl/Makefile.sources
+++ b/src/glsl/Makefile.sources
@@ -59,7 +59,6 @@ LIBGLSL_FILES = \
$(GLSL_SRCDIR)/loop_analysis.cpp \
$(GLSL_SRCDIR)/loop_controls.cpp \
$(GLSL_SRCDIR)/loop_unroll.cpp \
- $(GLSL_SRCDIR)/lower_bounded_loops.cpp \
$(GLSL_SRCDIR)/lower_clip_distance.cpp \
$(GLSL_SRCDIR)/lower_discard.cpp \
$(GLSL_SRCDIR)/lower_discard_flow.cpp \
diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
index 702263f..6ff38c1 100644
--- a/src/glsl/ir.cpp
+++ b/src/glsl/ir.cpp
@@ -1277,7 +1277,6 @@ ir_constant::is_basis() const
ir_loop::ir_loop()
{
this->ir_type = ir_type_loop;
- this->normative_bound = -1;
}
diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index d1dc6df..a8d0537 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -1023,13 +1023,6 @@ public:
/** List of ir_instruction that make up the body of the loop. */
exec_list body_instructions;
-
- /**
- * Normative bound for the loop. If this value is >= 0, the back-end
- * should generate instructions to ensure that the loop executes no more
- * than this many times.
- */
- int normative_bound;
};
diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp
index 7ba426d..c96f2b2 100644
--- a/src/glsl/ir_clone.cpp
+++ b/src/glsl/ir_clone.cpp
@@ -157,8 +157,6 @@ ir_loop::clone(void *mem_ctx, struct hash_table *ht) const
{
ir_loop *new_loop = new(mem_ctx) ir_loop();
- new_loop->normative_bound = this->normative_bound;
-
foreach_iter(exec_list_iterator, iter, this->body_instructions) {
ir_instruction *ir = (ir_instruction *)iter.get();
new_loop->body_instructions.push_tail(ir->clone(mem_ctx, ht));
diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h
index 87c2c82..3ca9f57 100644
--- a/src/glsl/ir_optimization.h
+++ b/src/glsl/ir_optimization.h
@@ -101,7 +101,6 @@ bool do_swizzle_swizzle(exec_list *instructions);
bool do_tree_grafting(exec_list *instructions);
bool do_vec_index_to_cond_assign(exec_list *instructions);
bool do_vec_index_to_swizzle(exec_list *instructions);
-bool lower_bounded_loops(exec_list *instructions);
bool lower_discard(exec_list *instructions);
void lower_discard_flow(exec_list *instructions);
bool lower_instructions(exec_list *instructions, unsigned what_to_lower);
diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp
index c9ee1e3..5ae9a1e 100644
--- a/src/glsl/ir_print_visitor.cpp
+++ b/src/glsl/ir_print_visitor.cpp
@@ -522,10 +522,7 @@ ir_print_visitor::visit(ir_if *ir)
void
ir_print_visitor::visit(ir_loop *ir)
{
- printf("(loop (");
- if (ir->normative_bound >= 0)
- printf("%d", ir->normative_bound);
- printf(") (\n");
+ printf("(loop (\n");
indentation++;
foreach_iter(exec_list_iterator, iter, ir->body_instructions) {
diff --git a/src/glsl/ir_reader.cpp b/src/glsl/ir_reader.cpp
index 4390682..53a2284 100644
--- a/src/glsl/ir_reader.cpp
+++ b/src/glsl/ir_reader.cpp
@@ -486,34 +486,16 @@ ir_reader::read_if(s_expression *expr, ir_loop *loop_ctx)
ir_loop *
ir_reader::read_loop(s_expression *expr)
{
- s_expression *s_bound_expr, *s_body, *s_bound;
+ s_expression *s_body;
- s_pattern loop_pat[] = { "loop", s_bound_expr, s_body };
- s_pattern no_bound_pat[] = { };
- s_pattern bound_pat[] = { s_bound };
+ s_pattern loop_pat[] = { "loop", s_body };
if (!MATCH(expr, loop_pat)) {
- ir_read_error(expr, "expected (loop <bound> <body>)");
+ ir_read_error(expr, "expected (loop <body>)");
return NULL;
}
ir_loop *loop = new(mem_ctx) ir_loop;
- if (MATCH(s_bound_expr, no_bound_pat)) {
- loop->normative_bound = -1;
- } else if (MATCH(s_bound_expr, bound_pat)) {
- s_int *value = SX_AS_INT(s_bound);
- if (value == NULL) {
- ir_read_error(s_bound_expr, "malformed loop bound");
- delete loop;
- return NULL;
- }
- loop->normative_bound = value->value();
- } else {
- ir_read_error(s_bound_expr, "malformed loop bound");
- delete loop;
- return NULL;
- }
-
read_instructions(&loop->body_instructions, s_body, loop);
if (state->error) {
delete loop;
diff --git a/src/glsl/loop_controls.cpp b/src/glsl/loop_controls.cpp
index 385c203..3db06ad 100644
--- a/src/glsl/loop_controls.cpp
+++ b/src/glsl/loop_controls.cpp
@@ -193,13 +193,6 @@ loop_control_visitor::visit_leave(ir_loop *ir)
this->progress = true;
return visit_continue;
}
-
- /* If the limiting terminator has a lower iteration count than the
- * normative loop bound (if any), then the loop doesn't need a normative
- * bound anymore.
- */
- if (ir->normative_bound >= 0 && iterations < ir->normative_bound)
- ir->normative_bound = -1;
}
/* Remove the conditional break statements associated with all terminators
@@ -215,7 +208,7 @@ loop_control_visitor::visit_leave(ir_loop *ir)
if (t->iterations < 0)
continue;
- if (ir->normative_bound >= 0 || t != ls->limiting_terminator) {
+ if (t != ls->limiting_terminator) {
t->ir->remove();
assert(ls->num_loop_jumps > 0);
diff --git a/src/glsl/loop_unroll.cpp b/src/glsl/loop_unroll.cpp
index 4645dcb..6eced17 100644
--- a/src/glsl/loop_unroll.cpp
+++ b/src/glsl/loop_unroll.cpp
@@ -228,9 +228,6 @@ loop_unroll_visitor::visit_leave(ir_loop *ir)
loop_variable_state *const ls = this->state->get(ir);
int iterations;
- /* Note: normatively-bounded loops aren't created anymore. */
- assert(ir->normative_bound < 0);
-
/* If we've entered a loop that hasn't been analyzed, something really,
* really bad has happened.
*/
diff --git a/src/glsl/lower_bounded_loops.cpp b/src/glsl/lower_bounded_loops.cpp
deleted file mode 100644
index 0cd907d..0000000
--- a/src/glsl/lower_bounded_loops.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright © 2013 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-/** \file
- *
- * This pass converts bounded loops (those whose ir_loop contains non-null
- * values for \c from, \c to, \c increment, and \c counter) into unbounded
- * loops.
- *
- * For instance:
- *
- * (loop (declare () uint i) (constant uint 0) (constant uint 4)
- * (constant uint 1)
- * ...loop body...)
- *
- * Is transformed into:
- *
- * (declare () uint i)
- * (assign (x) (var_ref i) (constant uint 0))
- * (loop
- * (if (expression bool >= (var_ref i) (constant uint 4))
- * (break)
- * ())
- * ...loop body...
- * (assign (x) (var_ref i)
- * (expression uint + (var_ref i) (constant uint 1))))
- */
-
-#include "ir_hierarchical_visitor.h"
-#include "ir.h"
-#include "ir_builder.h"
-
-using namespace ir_builder;
-
-namespace {
-
-class lower_bounded_loops_visitor : public ir_hierarchical_visitor {
-public:
- lower_bounded_loops_visitor()
- : progress(false)
- {
- }
-
- virtual ir_visitor_status visit_leave(ir_loop *ir);
-
- bool progress;
-};
-
-} /* anonymous namespace */
-
-
-ir_visitor_status
-lower_bounded_loops_visitor::visit_leave(ir_loop *ir)
-{
- if (ir->normative_bound < 0)
- return visit_continue;
-
- exec_list new_instructions;
- ir_factory f(&new_instructions, ralloc_parent(ir));
-
- /* Before the loop, declare the counter and initialize it to zero. */
- ir_variable *counter = f.make_temp(glsl_type::uint_type, "counter");
- f.emit(assign(counter, f.constant(0u)));
- ir->insert_before(&new_instructions);
-
- /* At the top of the loop, compare the counter to normative_bound, and
- * break if the comparison succeeds.
- */
- ir_loop_jump *brk = new(f.mem_ctx) ir_loop_jump(ir_loop_jump::jump_break);
- ir_if *if_inst = if_tree(gequal(counter,
- f.constant((unsigned) ir->normative_bound)),
- brk);
- ir->body_instructions.push_head(if_inst);
-
- /* At the bottom of the loop, increment the counter. */
- ir->body_instructions.push_tail(assign(counter,
- add(counter, f.constant(1u))));
-
- /* Since we've explicitly added instructions to terminate the loop, we no
- * longer need it to have a normative bound.
- */
- ir->normative_bound = -1;
-
- this->progress = true;
- return visit_continue;
-}
-
-
-bool
-lower_bounded_loops(exec_list *instructions)
-{
- lower_bounded_loops_visitor v;
-
- visit_list_elements(&v, instructions);
-
- return v.progress;
-}
diff --git a/src/glsl/tests/lower_jumps/lower_breaks_1.opt_test b/src/glsl/tests/lower_jumps/lower_breaks_1.opt_test
index c38ed9e..b412ba8 100755
--- a/src/glsl/tests/lower_jumps/lower_breaks_1.opt_test
+++ b/src/glsl/tests/lower_jumps/lower_breaks_1.opt_test
@@ -8,6 +8,6 @@
((declare (out) float a)
(function main
(signature void (parameters)
- ((loop ()
+ ((loop
((assign (x) (var_ref a) (constant float (1.000000))) break))))))
EOF
diff --git a/src/glsl/tests/lower_jumps/lower_breaks_1.opt_test.expected b/src/glsl/tests/lower_jumps/lower_breaks_1.opt_test.expected
index b278b1c..56ef3e4 100644
--- a/src/glsl/tests/lower_jumps/lower_breaks_1.opt_test.expected
+++ b/src/glsl/tests/lower_jumps/lower_breaks_1.opt_test.expected
@@ -1,5 +1,5 @@
((declare (out) float a)
(function main
(signature void (parameters)
- ((loop ()
+ ((loop
((assign (x) (var_ref a) (constant float (1.000000))) break))))))
diff --git a/src/glsl/tests/lower_jumps/lower_breaks_2.opt_test b/src/glsl/tests/lower_jumps/lower_breaks_2.opt_test
index a4a94e0..f5de803 100755
--- a/src/glsl/tests/lower_jumps/lower_breaks_2.opt_test
+++ b/src/glsl/tests/lower_jumps/lower_breaks_2.opt_test
@@ -8,7 +8,7 @@
((declare (in) float b) (declare (out) float a)
(function main
(signature void (parameters)
- ((loop ()
+ ((loop
((assign (x) (var_ref a) (constant float (1.000000)))
(if (expression bool > (var_ref b) (constant float (0.000000))) (break)
())))))))
diff --git a/src/glsl/tests/lower_jumps/lower_breaks_2.opt_test.expected b/src/glsl/tests/lower_jumps/lower_breaks_2.opt_test.expected
index 90156be..dc231f9 100644
--- a/src/glsl/tests/lower_jumps/lower_breaks_2.opt_test.expected
+++ b/src/glsl/tests/lower_jumps/lower_breaks_2.opt_test.expected
@@ -1,7 +1,7 @@
((declare (in) float b) (declare (out) float a)
(function main
(signature void (parameters)
- ((loop ()
+ ((loop
((assign (x) (var_ref a) (constant float (1.000000)))
(if (expression bool > (var_ref b) (constant float (0.0))) (break)
())))))))
diff --git a/src/glsl/tests/lower_jumps/lower_breaks_3.opt_test b/src/glsl/tests/lower_jumps/lower_breaks_3.opt_test
index 4475eea..60368bc 100755
--- a/src/glsl/tests/lower_jumps/lower_breaks_3.opt_test
+++ b/src/glsl/tests/lower_jumps/lower_breaks_3.opt_test
@@ -9,7 +9,7 @@
((declare (in) float b) (declare (out) float a) (declare (out) float c)
(function main
(signature void (parameters)
- ((loop ()
+ ((loop
((assign (x) (var_ref a) (constant float (1.000000)))
(if (expression bool > (var_ref b) (constant float (0.000000)))
((assign (x) (var_ref c) (constant float (1.000000))) break)
diff --git a/src/glsl/tests/lower_jumps/lower_breaks_3.opt_test.expected b/src/glsl/tests/lower_jumps/lower_breaks_3.opt_test.expected
index e31a712..8131b66 100644
--- a/src/glsl/tests/lower_jumps/lower_breaks_3.opt_test.expected
+++ b/src/glsl/tests/lower_jumps/lower_breaks_3.opt_test.expected
@@ -1,7 +1,7 @@
((declare (in) float b) (declare (out) float a) (declare (out) float c)
(function main
(signature void (parameters)
- ((loop ()
+ ((loop
((assign (x) (var_ref a) (constant float (1.000000)))
(if (expression bool > (var_ref b) (constant float (0.0)))
((assign (x) (var_ref c) (constant float (1.000000))) break)
diff --git a/src/glsl/tests/lower_jumps/lower_breaks_4.opt_test b/src/glsl/tests/lower_jumps/lower_breaks_4.opt_test
index cb06cfd..cde3197 100755
--- a/src/glsl/tests/lower_jumps/lower_breaks_4.opt_test
+++ b/src/glsl/tests/lower_jumps/lower_breaks_4.opt_test
@@ -8,7 +8,7 @@
((declare (in) float b) (declare (out) float a)
(function main
(signature void (parameters)
- ((loop ()
+ ((loop
((assign (x) (var_ref a) (constant float (1.000000)))
(if (expression bool > (var_ref b) (constant float (0.000000))) ()
(break))))))))
diff --git a/src/glsl/tests/lower_jumps/lower_breaks_4.opt_test.expected b/src/glsl/tests/lower_jumps/lower_breaks_4.opt_test.expected
index 3c216ed..94dcb37 100644
--- a/src/glsl/tests/lower_jumps/lower_breaks_4.opt_test.expected
+++ b/src/glsl/tests/lower_jumps/lower_breaks_4.opt_test.expected
@@ -1,7 +1,7 @@
((declare (in) float b) (declare (out) float a)
(function main
(signature void (parameters)
- ((loop ()
+ ((loop
((assign (x) (var_ref a) (constant float (1.000000)))
(if (expression bool > (var_ref b) (constant float (0.0))) ()
(break))))))))
diff --git a/src/glsl/tests/lower_jumps/lower_breaks_5.opt_test b/src/glsl/tests/lower_jumps/lower_breaks_5.opt_test
index 0a7a112..157b589 100755
--- a/src/glsl/tests/lower_jumps/lower_breaks_5.opt_test
+++ b/src/glsl/tests/lower_jumps/lower_breaks_5.opt_test
@@ -9,7 +9,7 @@
((declare (in) float b) (declare (out) float a) (declare (out) float c)
(function main
(signature void (parameters)
- ((loop ()
+ ((loop
((assign (x) (var_ref a) (constant float (1.000000)))
(if (expression bool > (var_ref b) (constant float (0.000000))) ()
((assign (x) (var_ref c) (constant float (1.000000))) break))))))))
diff --git a/src/glsl/tests/lower_jumps/lower_breaks_5.opt_test.expected b/src/glsl/tests/lower_jumps/lower_breaks_5.opt_test.expected
index 45e718d..5b46ccb 100644
--- a/src/glsl/tests/lower_jumps/lower_breaks_5.opt_test.expected
+++ b/src/glsl/tests/lower_jumps/lower_breaks_5.opt_test.expected
@@ -1,7 +1,7 @@
((declare (in) float b) (declare (out) float a) (declare (out) float c)
(function main
(signature void (parameters)
- ((loop ()
+ ((loop
((assign (x) (var_ref a) (constant float (1.000000)))
(if (expression bool > (var_ref b) (constant float (0.0))) ()
((assign (x) (var_ref c) (constant float (1.000000))) break))))))))
diff --git a/src/glsl/tests/lower_jumps/lower_breaks_6.opt_test b/src/glsl/tests/lower_jumps/lower_breaks_6.opt_test
index 4786063..4767df1 100755
--- a/src/glsl/tests/lower_jumps/lower_breaks_6.opt_test
+++ b/src/glsl/tests/lower_jumps/lower_breaks_6.opt_test
@@ -12,7 +12,7 @@
(declare (in) float cb)
(function main
(signature void (parameters)
- ((loop ()
+ ((loop
((if (expression bool > (var_ref a) (constant float (0.000000)))
((if (expression bool > (var_ref ba) (constant float (0.000000)))
((if (expression bool > (var_ref bb) (constant float (0.000000)))
diff --git a/src/glsl/tests/lower_jumps/lower_breaks_6.opt_test.expected b/src/glsl/tests/lower_jumps/lower_breaks_6.opt_test.expected
index 338d751..967ce64 100644
--- a/src/glsl/tests/lower_jumps/lower_breaks_6.opt_test.expected
+++ b/src/glsl/tests/lower_jumps/lower_breaks_6.opt_test.expected
@@ -5,7 +5,7 @@
(signature void (parameters)
((declare (temporary) bool break_flag)
(assign (x) (var_ref break_flag) (constant bool (0)))
- (loop ()
+ (loop
((declare (temporary) bool execute_flag)
(assign (x) (var_ref execute_flag) (constant bool (1)))
(if (expression bool > (var_ref a) (constant float (0.0)))
diff --git a/src/glsl/tests/lower_jumps/lower_guarded_conditional_break.opt_test b/src/glsl/tests/lower_jumps/lower_guarded_conditional_break.opt_test
index 0f84c5d..164914a 100755
--- a/src/glsl/tests/lower_jumps/lower_guarded_conditional_break.opt_test
+++ b/src/glsl/tests/lower_jumps/lower_guarded_conditional_break.opt_test
@@ -10,7 +10,7 @@
((declare (in) float aa) (declare (in) float ab) (declare (in) float b)
(function main
(signature void (parameters)
- ((loop ()
+ ((loop
((if (expression bool > (var_ref aa) (constant float (0.000000)))
((if (expression bool > (var_ref ab) (constant float (0.000000)))
(continue)
diff --git a/src/glsl/tests/lower_jumps/lower_guarded_conditional_break.opt_test.expected b/src/glsl/tests/lower_jumps/lower_guarded_conditional_break.opt_test.expected
index 3ce323a..841073e 100644
--- a/src/glsl/tests/lower_jumps/lower_guarded_conditional_break.opt_test.expected
+++ b/src/glsl/tests/lower_jumps/lower_guarded_conditional_break.opt_test.expected
@@ -3,7 +3,7 @@
(signature void (parameters)
((declare (temporary) bool break_flag)
(assign (x) (var_ref break_flag) (constant bool (0)))
- (loop ()
+ (loop
((declare (temporary) bool execute_flag)
(assign (x) (var_ref execute_flag) (constant bool (1)))
(if (expression bool > (var_ref aa) (constant float (0.0)))
diff --git a/src/glsl/tests/lower_jumps/lower_pulled_out_jump.opt_test b/src/glsl/tests/lower_jumps/lower_pulled_out_jump.opt_test
index cebdad7..1a5c096 100755
--- a/src/glsl/tests/lower_jumps/lower_pulled_out_jump.opt_test
+++ b/src/glsl/tests/lower_jumps/lower_pulled_out_jump.opt_test
@@ -19,7 +19,7 @@
((return))
()))
())
- (loop ()
+ (loop
((if (expression bool > (var_ref b) (constant float (0.000000)))
((if (expression bool > (var_ref c) (constant float (0.000000))) (break)
(continue)))
diff --git a/src/glsl/tests/lower_jumps/lower_pulled_out_jump.opt_test.expected b/src/glsl/tests/lower_jumps/lower_pulled_out_jump.opt_test.expected
index e4339b1..cf2ef3f 100644
--- a/src/glsl/tests/lower_jumps/lower_pulled_out_jump.opt_test.expected
+++ b/src/glsl/tests/lower_jumps/lower_pulled_out_jump.opt_test.expected
@@ -14,7 +14,7 @@
()))
())
(if (var_ref execute_flag)
- ((loop ()
+ ((loop
((if (expression bool > (var_ref b) (constant float (0.0)))
((if (expression bool > (var_ref c) (constant float (0.0))) ()
(continue)))
diff --git a/src/glsl/tests/lower_jumps/remove_continue_at_end_of_loop.opt_test b/src/glsl/tests/lower_jumps/remove_continue_at_end_of_loop.opt_test
index da1caad..8403bb2 100755
--- a/src/glsl/tests/lower_jumps/remove_continue_at_end_of_loop.opt_test
+++ b/src/glsl/tests/lower_jumps/remove_continue_at_end_of_loop.opt_test
@@ -8,6 +8,6 @@
((declare (out) float a)
(function main
(signature void (parameters)
- ((loop ()
+ ((loop
((assign (x) (var_ref a) (constant float (1.000000))) continue))))))
EOF
diff --git a/src/glsl/tests/lower_jumps/remove_continue_at_end_of_loop.opt_test.expected b/src/glsl/tests/lower_jumps/remove_continue_at_end_of_loop.opt_test.expected
index df2b548..98b74d7 100644
--- a/src/glsl/tests/lower_jumps/remove_continue_at_end_of_loop.opt_test.expected
+++ b/src/glsl/tests/lower_jumps/remove_continue_at_end_of_loop.opt_test.expected
@@ -1,5 +1,5 @@
((declare (out) float a)
(function main
(signature void (parameters)
- ((loop ()
+ ((loop
((assign (x) (var_ref a) (constant float (1.000000)))))))))
diff --git a/src/glsl/tests/lower_jumps/return_non_void_at_end_of_loop_lower_nothing.opt_test b/src/glsl/tests/lower_jumps/return_non_void_at_end_of_loop_lower_nothing.opt_test
index 0b46a79..1f62e73 100755
--- a/src/glsl/tests/lower_jumps/return_non_void_at_end_of_loop_lower_nothing.opt_test
+++ b/src/glsl/tests/lower_jumps/return_non_void_at_end_of_loop_lower_nothing.opt_test
@@ -8,7 +8,7 @@
((declare (out) float a) (declare (out) float b)
(function sub
(signature float (parameters)
- ((loop ()
+ ((loop
((assign (x) (var_ref a) (constant float (1.000000)))
(return (constant float (2.000000)))))
(assign (x) (var_ref b) (constant float (3.000000)))
diff --git a/src/glsl/tests/lower_jumps/return_non_void_at_end_of_loop_lower_nothing.opt_test.expected b/src/glsl/tests/lower_jumps/return_non_void_at_end_of_loop_lower_nothing.opt_test.expected
index a1f3cde..040d383 100644
--- a/src/glsl/tests/lower_jumps/return_non_void_at_end_of_loop_lower_nothing.opt_test.expected
+++ b/src/glsl/tests/lower_jumps/return_non_void_at_end_of_loop_lower_nothing.opt_test.expected
@@ -1,7 +1,7 @@
((declare (out) float a) (declare (out) float b)
(function sub
(signature float (parameters)
- ((loop ()
+ ((loop
((assign (x) (var_ref a) (constant float (1.000000)))
(return (constant float (2.000000)))))
(assign (x) (var_ref b) (constant float (3.000000)))
diff --git a/src/glsl/tests/lower_jumps/return_non_void_at_end_of_loop_lower_return.opt_test b/src/glsl/tests/lower_jumps/return_non_void_at_end_of_loop_lower_return.opt_test
index 0d73a66..42c4e75 100755
--- a/src/glsl/tests/lower_jumps/return_non_void_at_end_of_loop_lower_return.opt_test
+++ b/src/glsl/tests/lower_jumps/return_non_void_at_end_of_loop_lower_return.opt_test
@@ -8,7 +8,7 @@
((declare (out) float a) (declare (out) float b)
(function sub
(signature float (parameters)
- ((loop ()
+ ((loop
((assign (x) (var_ref a) (constant float (1.000000)))
(return (constant float (2.000000)))))
(assign (x) (var_ref b) (constant float (3.000000)))
diff --git a/src/glsl/tests/lower_jumps/return_non_void_at_end_of_loop_lower_return.opt_test.expected b/src/glsl/tests/lower_jumps/return_non_void_at_end_of_loop_lower_return.opt_test.expected
index 52bc99c..792cbf6 100644
--- a/src/glsl/tests/lower_jumps/return_non_void_at_end_of_loop_lower_return.opt_test.expected
+++ b/src/glsl/tests/lower_jumps/return_non_void_at_end_of_loop_lower_return.opt_test.expected
@@ -6,7 +6,7 @@
(declare (temporary) float return_value)
(declare (temporary) bool return_flag)
(assign (x) (var_ref return_flag) (constant bool (0)))
- (loop ()
+ (loop
((assign (x) (var_ref a) (constant float (1.000000)))
(assign (x) (var_ref return_value) (constant float (2.000000)))
(assign (x) (var_ref return_flag) (constant bool (1)))
diff --git a/src/glsl/tests/lower_jumps/return_non_void_at_end_of_loop_lower_return_and_break.opt_test b/src/glsl/tests/lower_jumps/return_non_void_at_end_of_loop_lower_return_and_break.opt_test
index 8b08c99..b3eef39 100755
--- a/src/glsl/tests/lower_jumps/return_non_void_at_end_of_loop_lower_return_and_break.opt_test
+++ b/src/glsl/tests/lower_jumps/return_non_void_at_end_of_loop_lower_return_and_break.opt_test
@@ -8,7 +8,7 @@
((declare (out) float a) (declare (out) float b)
(function sub
(signature float (parameters)
- ((loop ()
+ ((loop
((assign (x) (var_ref a) (constant float (1.000000)))
(return (constant float (2.000000)))))
(assign (x) (var_ref b) (constant float (3.000000)))
diff --git a/src/glsl/tests/lower_jumps/return_non_void_at_end_of_loop_lower_return_and_break.opt_test.expected b/src/glsl/tests/lower_jumps/return_non_void_at_end_of_loop_lower_return_and_break.opt_test.expected
index 52bc99c..792cbf6 100644
--- a/src/glsl/tests/lower_jumps/return_non_void_at_end_of_loop_lower_return_and_break.opt_test.expected
+++ b/src/glsl/tests/lower_jumps/return_non_void_at_end_of_loop_lower_return_and_break.opt_test.expected
@@ -6,7 +6,7 @@
(declare (temporary) float return_value)
(declare (temporary) bool return_flag)
(assign (x) (var_ref return_flag) (constant bool (0)))
- (loop ()
+ (loop
((assign (x) (var_ref a) (constant float (1.000000)))
(assign (x) (var_ref return_value) (constant float (2.000000)))
(assign (x) (var_ref return_flag) (constant bool (1)))
diff --git a/src/glsl/tests/lower_jumps/return_void_at_end_of_loop_lower_nothing.opt_test b/src/glsl/tests/lower_jumps/return_void_at_end_of_loop_lower_nothing.opt_test
index f5b45bc..0408282 100755
--- a/src/glsl/tests/lower_jumps/return_void_at_end_of_loop_lower_nothing.opt_test
+++ b/src/glsl/tests/lower_jumps/return_void_at_end_of_loop_lower_nothing.opt_test
@@ -8,7 +8,7 @@
((declare (out) float a) (declare (out) float b)
(function main
(signature void (parameters)
- ((loop ()
+ ((loop
((assign (x) (var_ref a) (constant float (1.000000))) (return)))
(assign (x) (var_ref b) (constant float (2.000000)))))))
EOF
diff --git a/src/glsl/tests/lower_jumps/return_void_at_end_of_loop_lower_nothing.opt_test.expected b/src/glsl/tests/lower_jumps/return_void_at_end_of_loop_lower_nothing.opt_test.expected
index ae9359f..569213e 100644
--- a/src/glsl/tests/lower_jumps/return_void_at_end_of_loop_lower_nothing.opt_test.expected
+++ b/src/glsl/tests/lower_jumps/return_void_at_end_of_loop_lower_nothing.opt_test.expected
@@ -1,6 +1,6 @@
((declare (out) float a) (declare (out) float b)
(function main
(signature void (parameters)
- ((loop ()
+ ((loop
((assign (x) (var_ref a) (constant float (1.000000))) (return)))
(assign (x) (var_ref b) (constant float (2.000000)))))))
diff --git a/src/glsl/tests/lower_jumps/return_void_at_end_of_loop_lower_return.opt_test b/src/glsl/tests/lower_jumps/return_void_at_end_of_loop_lower_return.opt_test
index 2a02101..a7e65c8 100755
--- a/src/glsl/tests/lower_jumps/return_void_at_end_of_loop_lower_return.opt_test
+++ b/src/glsl/tests/lower_jumps/return_void_at_end_of_loop_lower_return.opt_test
@@ -8,7 +8,7 @@
((declare (out) float a) (declare (out) float b)
(function main
(signature void (parameters)
- ((loop ()
+ ((loop
((assign (x) (var_ref a) (constant float (1.000000))) (return)))
(assign (x) (var_ref b) (constant float (2.000000)))))))
EOF
diff --git a/src/glsl/tests/lower_jumps/return_void_at_end_of_loop_lower_return.opt_test.expected b/src/glsl/tests/lower_jumps/return_void_at_end_of_loop_lower_return.opt_test.expected
index d6dd1db..66f3aec 100644
--- a/src/glsl/tests/lower_jumps/return_void_at_end_of_loop_lower_return.opt_test.expected
+++ b/src/glsl/tests/lower_jumps/return_void_at_end_of_loop_lower_return.opt_test.expected
@@ -3,7 +3,7 @@
(signature void (parameters)
((declare (temporary) bool return_flag)
(assign (x) (var_ref return_flag) (constant bool (0)))
- (loop ()
+ (loop
((assign (x) (var_ref a) (constant float (1.000000)))
(assign (x) (var_ref return_flag) (constant bool (1)))
break))
diff --git a/src/glsl/tests/lower_jumps/return_void_at_end_of_loop_lower_return_and_break.opt_test b/src/glsl/tests/lower_jumps/return_void_at_end_of_loop_lower_return_and_break.opt_test
index 4c6f959..7a5efe5 100755
--- a/src/glsl/tests/lower_jumps/return_void_at_end_of_loop_lower_return_and_break.opt_test
+++ b/src/glsl/tests/lower_jumps/return_void_at_end_of_loop_lower_return_and_break.opt_test
@@ -8,7 +8,7 @@
((declare (out) float a) (declare (out) float b)
(function main
(signature void (parameters)
- ((loop ()
+ ((loop
((assign (x) (var_ref a) (constant float (1.000000))) (return)))
(assign (x) (var_ref b) (constant float (2.000000)))))))
EOF
diff --git a/src/glsl/tests/lower_jumps/return_void_at_end_of_loop_lower_return_and_break.opt_test.expected b/src/glsl/tests/lower_jumps/return_void_at_end_of_loop_lower_return_and_break.opt_test.expected
index d6dd1db..66f3aec 100644
--- a/src/glsl/tests/lower_jumps/return_void_at_end_of_loop_lower_return_and_break.opt_test.expected
+++ b/src/glsl/tests/lower_jumps/return_void_at_end_of_loop_lower_return_and_break.opt_test.expected
@@ -3,7 +3,7 @@
(signature void (parameters)
((declare (temporary) bool return_flag)
(assign (x) (var_ref return_flag) (constant bool (0)))
- (loop ()
+ (loop
((assign (x) (var_ref a) (constant float (1.000000)))
(assign (x) (var_ref return_flag) (constant bool (1)))
break))
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 3e29b96..f492b51 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -2135,11 +2135,6 @@ fs_visitor::visit(ir_if *ir)
void
fs_visitor::visit(ir_loop *ir)
{
- /* Any normative loop bounds should have been lowered by
- * lower_bounded_loops().
- */
- assert(ir->normative_bound < 0);
-
if (brw->gen < 6 && dispatch_width == 16) {
fail("Can't support (non-uniform) control flow on 16-wide\n");
}
diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp
index 1027910..ddb4524 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -213,8 +213,6 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
|| progress;
} while (progress);
- lower_bounded_loops(shader->ir);
-
/* Make a pass over the IR to add state references for any built-in
* uniforms that are used. This has to be done now (during linking).
* Code generation doesn't happen until the first time this shader is
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index b18ec4c..f82ccfb 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -1007,11 +1007,6 @@ vec4_visitor::visit(ir_variable *ir)
void
vec4_visitor::visit(ir_loop *ir)
{
- /* Any normative loop bounds should have been lowered by
- * lower_bounded_loops().
- */
- assert(ir->normative_bound < 0);
-
/* We don't want debugging output to print the whole body of the
* loop as the annotation.
*/
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index 583cdef..ad6c242 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -759,11 +759,6 @@ ir_to_mesa_visitor::visit(ir_variable *ir)
void
ir_to_mesa_visitor::visit(ir_loop *ir)
{
- /* Any normative loop bounds should have been lowered by
- * lower_bounded_loops().
- */
- assert(ir->normative_bound < 0);
-
emit(NULL, OPCODE_BGNLOOP);
visit_exec_list(&ir->body_instructions, this);
@@ -3057,8 +3052,6 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
progress = lower_vector_insert(ir, true) || progress;
} while (progress);
- lower_bounded_loops(ir);
-
validate_ir_tree(ir);
}
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 18d2a5b..a1ee24f 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -1137,11 +1137,6 @@ glsl_to_tgsi_visitor::visit(ir_variable *ir)
void
glsl_to_tgsi_visitor::visit(ir_loop *ir)
{
- /* Any normative loop bounds should have been lowered by
- * lower_bounded_loops().
- */
- assert(ir->normative_bound < 0);
-
emit(NULL, TGSI_OPCODE_BGNLOOP);
visit_exec_list(&ir->body_instructions, this);
@@ -5307,8 +5302,6 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
} while (progress);
- lower_bounded_loops(ir);
-
validate_ir_tree(ir);
}
--
1.8.4.2
More information about the mesa-dev
mailing list