diff options
author | Luca Barbieri <luca@luca-barbieri.com> | 2010-09-07 17:02:37 +0200 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2010-09-13 13:03:10 -0700 |
commit | 710d41131b9715c5c378e0138d991f346647b9c8 (patch) | |
tree | 7ec6f0ef2249cb12055dd01ad40049121a272a31 /src/glsl/loop_controls.cpp | |
parent | 4de7a3b76add1940f7316253a619c3728025d9db (diff) | |
download | external_mesa3d-710d41131b9715c5c378e0138d991f346647b9c8.zip external_mesa3d-710d41131b9715c5c378e0138d991f346647b9c8.tar.gz external_mesa3d-710d41131b9715c5c378e0138d991f346647b9c8.tar.bz2 |
loop_controls: fix analysis of already analyzed loops
The loop_controls pass didn't look at the counter values it put in ir_loop
on previous iterations, so while the first iteration worked, subsequent
ones couldn't determine max_iterations.
Diffstat (limited to 'src/glsl/loop_controls.cpp')
-rw-r--r-- | src/glsl/loop_controls.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/glsl/loop_controls.cpp b/src/glsl/loop_controls.cpp index 17a0d2d..9619d8a 100644 --- a/src/glsl/loop_controls.cpp +++ b/src/glsl/loop_controls.cpp @@ -182,7 +182,14 @@ loop_control_visitor::visit_leave(ir_loop *ir) * i is a loop induction variable, c is a constant, and < is any relative * operator. */ - int max_iterations = (ls->max_iterations < 0) ? INT_MAX : ls->max_iterations; + int max_iterations = ls->max_iterations; + + if(ir->from && ir->to && ir->increment) + max_iterations = calculate_iterations(ir->from, ir->to, ir->increment, (ir_expression_operation)ir->cmp); + + if(max_iterations < 0) + max_iterations = INT_MAX; + foreach_list(node, &ls->terminators) { loop_terminator *t = (loop_terminator *) node; ir_if *if_stmt = t->ir; |