freedreno/ir3: fix crash in RA
authorRob Clark <robclark@freedesktop.org>
Fri, 26 Jun 2015 18:32:08 +0000 (14:32 -0400)
committerRob Clark <robclark@freedesktop.org>
Tue, 30 Jun 2015 16:13:44 +0000 (12:13 -0400)
Signed-off-by: Rob Clark <robclark@freedesktop.org>
src/gallium/drivers/freedreno/ir3/ir3_ra.c

index 0436e01..ee610c7 100644 (file)
@@ -403,6 +403,7 @@ get_definer(struct ir3_instruction *instr, int *sz, int *off)
                 * the phi, so we don't need to chase definers
                 */
                struct ir3_register *src;
+               struct ir3_instruction *dd = d;
 
                /* note: don't use foreach_ssa_src as this gets called once
                 * while assigning regs (which clears SSA flag)
@@ -410,9 +411,11 @@ get_definer(struct ir3_instruction *instr, int *sz, int *off)
                foreach_src(src, d) {
                        if (!src->instr)
                                continue;
-                       if (src->instr->ip < d->ip)
-                               d = src->instr;
+                       if (src->instr->ip < dd->ip)
+                               dd = src->instr;
                }
+
+               d = dd;
        }
 
        if (is_meta(d) && (d->opc == OPC_META_FO)) {