aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl/loop_unroll.cpp
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-11-29 12:40:08 +0100
committermarha <marha@users.sourceforge.net>2014-11-29 12:40:08 +0100
commita1011d63ffb5cc4f41bf0f4622ee3f1493d419d9 (patch)
tree3875aa5d80808dfe3c52035a4148384d7090fb8a /mesalib/src/glsl/loop_unroll.cpp
parentd6d5581d5fba846c8476ad4d593da662306765d7 (diff)
downloadvcxsrv-a1011d63ffb5cc4f41bf0f4622ee3f1493d419d9.tar.gz
vcxsrv-a1011d63ffb5cc4f41bf0f4622ee3f1493d419d9.tar.bz2
vcxsrv-a1011d63ffb5cc4f41bf0f4622ee3f1493d419d9.zip
fontconfig libX11 libxcb libxcb/xcb-proto mesa xserver xkbcomp xkeyboard-config git update 29 Nov 2014
xserver commit c52a2b1ebad56820af932dfbc871701a8b04fd9c libxcb commit bbca7b82f803fa13fd30a2891ec06f2a213a28c2 libxcb/xcb-proto commit 691d2b97e5989d6d7006304d81bd8fa128477ca1 xkeyboard-config commit b664d7fb8aab9b0f834dd9c81d273c7809561b34 libX11 commit f3831dde6972e4da9e018c6a5f4013d8756a5e78 xkbcomp commit 1e8ee9d0aad072f04186df84752f5636340574e0 fontconfig commit b732bf057f4b3ec3bac539803005e9c42d056b2a mesa commit 67c498086d0858a94d53ebb6921cfda847250368
Diffstat (limited to 'mesalib/src/glsl/loop_unroll.cpp')
-rw-r--r--mesalib/src/glsl/loop_unroll.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/mesalib/src/glsl/loop_unroll.cpp b/mesalib/src/glsl/loop_unroll.cpp
index ce795f6cd..635e1dd99 100644
--- a/mesalib/src/glsl/loop_unroll.cpp
+++ b/mesalib/src/glsl/loop_unroll.cpp
@@ -64,6 +64,7 @@ class loop_unroll_count : public ir_hierarchical_visitor {
public:
int nodes;
bool unsupported_variable_indexing;
+ bool array_indexed_by_induction_var_with_exact_iterations;
/* If there are nested loops, the node count will be inaccurate. */
bool nested_loop;
@@ -74,6 +75,7 @@ public:
nodes = 0;
nested_loop = false;
unsupported_variable_indexing = false;
+ array_indexed_by_induction_var_with_exact_iterations = false;
run(list);
}
@@ -112,6 +114,14 @@ public:
ir_variable *array = ir->array->variable_referenced();
loop_variable *lv = ls->get(ir->array_index->variable_referenced());
if (array && lv && lv->is_induction_var()) {
+ /* If an array is indexed by a loop induction variable, and the
+ * array size is exactly the number of loop iterations, this is
+ * probably a simple for-loop trying to access each element in
+ * turn; the application may expect it to be unrolled.
+ */
+ if (int(array->type->length) == ls->limiting_terminator->iterations)
+ array_indexed_by_induction_var_with_exact_iterations = true;
+
switch (array->data.mode) {
case ir_var_auto:
case ir_var_temporary:
@@ -314,7 +324,8 @@ loop_unroll_visitor::visit_leave(ir_loop *ir)
bool loop_too_large =
count.nested_loop || count.nodes * iterations > max_iterations * 5;
- if (loop_too_large && !count.unsupported_variable_indexing)
+ if (loop_too_large && !count.unsupported_variable_indexing &&
+ !count.array_indexed_by_induction_var_with_exact_iterations)
return visit_continue;
/* Note: the limiting terminator contributes 1 to ls->num_loop_jumps.