projects
/
mesa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8df2dbf
)
glsl2: Eliminate zero-iteration loops
author
Ian Romanick
<ian.d.romanick@intel.com>
Fri, 27 Aug 2010 18:26:08 +0000
(11:26 -0700)
committer
Ian Romanick
<ian.d.romanick@intel.com>
Fri, 3 Sep 2010 18:55:21 +0000
(11:55 -0700)
src/glsl/loop_controls.cpp
patch
|
blob
|
history
diff --git
a/src/glsl/loop_controls.cpp
b/src/glsl/loop_controls.cpp
index 2eddb91364883745f34ae40b5ae9703edb54270d..9eb1a8901b0fb5c4832bff0d7eecddd4c0dc10f5 100644
(file)
--- a/
src/glsl/loop_controls.cpp
+++ b/
src/glsl/loop_controls.cpp
@@
-234,7
+234,7
@@
loop_control_visitor::visit_leave(ir_loop *ir)
const int iterations = calculate_iterations(init, limit,
lv->increment,
cmp);
- if (iterations > 0) {
+ if (iterations >
=
0) {
/* If the new iteration count is lower than the previously
* believed iteration count, update the loop control values.
*/
@@
-267,6
+267,12
@@
loop_control_visitor::visit_leave(ir_loop *ir)
}
}
+ /* If we have proven the one of the loop exit conditions is satisifed before
+ * running the loop once, remove the loop.
+ */
+ if (max_iterations == 0)
+ ir->remove();
+
return visit_continue;
}