i965/fs: Fix can_propagate_from() source/destination overlap check.
authorFrancisco Jerez <currojerez@riseup.net>
Fri, 2 Sep 2016 04:20:18 +0000 (21:20 -0700)
committerFrancisco Jerez <currojerez@riseup.net>
Wed, 14 Sep 2016 21:50:55 +0000 (14:50 -0700)
The previous overlap condition only made sure that the VGRF numbers or
GRF-aligned offsets were different without taking the amount of data
written and read by the instruction into consideration.  Use the
regions_overlap() helper instead.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp

index f8238aa6d77173b1fca20daa89515bb9263e1ccc..4a56aff5bdc313cb47bb7bb95c99326fb589189a 100644 (file)
@@ -739,8 +739,8 @@ can_propagate_from(fs_inst *inst)
    return (inst->opcode == BRW_OPCODE_MOV &&
            inst->dst.file == VGRF &&
            ((inst->src[0].file == VGRF &&
-             (inst->src[0].nr != inst->dst.nr ||
-              inst->src[0].offset / REG_SIZE != inst->dst.offset / REG_SIZE)) ||
+             !regions_overlap(inst->dst, inst->size_written,
+                              inst->src[0], inst->size_read(0))) ||
             inst->src[0].file == ATTR ||
             inst->src[0].file == UNIFORM ||
             inst->src[0].file == IMM) &&