diff options
author | Eric Anholt <[email protected]> | 2014-09-16 16:03:39 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2014-09-17 14:21:24 -0700 |
commit | 71d4fc88d6b97d6b9a8f1a324d2dcd0c56b79f3d (patch) | |
tree | e6e9d5db1fa30689f994c25e02917887b5070407 | |
parent | 79be2cc383f45e3e1e36e1ab774f2a3ea268cad5 (diff) |
vc4: Allow copy propagation of uniforms.
Fixes 12 piglit tests (and 8 more crash -> fail) from reducing register
pressure.
-rw-r--r-- | src/gallium/drivers/vc4/vc4_opt_copy_propagation.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/gallium/drivers/vc4/vc4_opt_copy_propagation.c b/src/gallium/drivers/vc4/vc4_opt_copy_propagation.c index b36bb4209a5..66b7c80a77d 100644 --- a/src/gallium/drivers/vc4/vc4_opt_copy_propagation.c +++ b/src/gallium/drivers/vc4/vc4_opt_copy_propagation.c @@ -45,10 +45,22 @@ qir_opt_copy_propagation(struct vc4_compile *c) foreach(node, &c->instructions) { struct qinst *inst = (struct qinst *)node; + /* A single instruction can only read one uniform value. (It + * could maybe read the same uniform value in two operands, + * but that doesn't seem important to do). + */ + bool reads_a_uniform = false; + for (int i = 0; i < qir_get_op_nsrc(inst->op); i++) { + if (inst->src[i].file == QFILE_UNIF) + reads_a_uniform = true; + } + for (int i = 0; i < qir_get_op_nsrc(inst->op); i++) { int index = inst->src[i].index; if (inst->src[i].file == QFILE_TEMP && - movs[index].file == QFILE_TEMP) { + (movs[index].file == QFILE_TEMP || + (movs[index].file == QFILE_UNIF && + !reads_a_uniform))) { if (debug) { fprintf(stderr, "Copy propagate: "); qir_dump_inst(inst); @@ -56,6 +68,8 @@ qir_opt_copy_propagation(struct vc4_compile *c) } inst->src[i] = movs[index]; + if (movs[index].file == QFILE_UNIF) + reads_a_uniform = true; if (debug) { fprintf(stderr, "to: "); |