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

Eric Anholt eric at anholt.net
Wed May 28 11:37:34 PDT 2014


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(-)

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;
-- 
2.0.0.rc2



More information about the mesa-dev mailing list