[Mesa-dev,03/16] mesa: Fix find_next_use() in the presence of RelAddr.

Submitted by Eric Anholt on May 28, 2014, 6:37 p.m.

Details

Message ID 1401302267-5038-4-git-send-email-eric@anholt.net
State New
Headers show

Not browsing as part of any series.

Commit Message

Eric Anholt May 28, 2014, 6:37 p.m.
Both callers of this function are doing dead code elimintation: "is this
reg completely rewritten before any of these components are used?".  If
there's reladdr on this write, then we don't know if the write landed in
our channels or not, but assuming that it didn't is conservative and safe.

This failure was hidden by the fact that the two passes would bail early
if any src reladdr was found, and programs using dst reladdr tended to use
src as well.  With my Mesa IR list changes, I happened to make those
passes not bail on instruction removal that they'd previously determined
was safe.
---
 src/mesa/program/prog_optimize.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/src/mesa/program/prog_optimize.c b/src/mesa/program/prog_optimize.c
index 6153f5e..4cba045 100644
--- a/src/mesa/program/prog_optimize.c
+++ b/src/mesa/program/prog_optimize.c
@@ -415,7 +415,8 @@  find_next_use(const struct gl_program *prog,
             }
             if (_mesa_num_inst_dst_regs(inst->Opcode) == 1 &&
                 inst->DstReg.File == PROGRAM_TEMPORARY &&
-                inst->DstReg.Index == index) {
+                inst->DstReg.Index == index &&
+                !inst->DstReg.RelAddr) {
                mask &= ~inst->DstReg.WriteMask;
                if (mask == 0)
                   return WRITE;