[Mesa-dev] [PATCH 07/12] i965/fs: Use the var_from_vgrf helper function instead of doing it manually
Matt Turner
mattst88 at gmail.com
Fri Sep 19 17:16:18 PDT 2014
On Fri, Sep 19, 2014 at 1:10 PM, Jason Ekstrand <jason at jlekstrand.net> wrote:
> Signed-off-by: Jason Ekstrand <jason.ekstrand at intel.com>
> ---
> src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp b/src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp
> index 697b44a..036875f 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_dead_code_eliminate.cpp
> @@ -58,7 +58,7 @@ fs_visitor::dead_code_eliminate()
> int var = live_intervals->var_from_reg(&inst->dst);
> result_live = BITSET_TEST(live, var);
> } else {
> - int var = live_intervals->var_from_vgrf[inst->dst.reg];
> + int var = live_intervals->var_from_reg(&inst->dst);
> for (int i = 0; i < inst->regs_written; i++) {
> result_live = result_live || BITSET_TEST(live, var + i);
This is wrong, isn't it? Before we get the base var and iterate 0
through regs_written. After we're getting the var of the
register+offset and then iterating.
> }
> @@ -78,19 +78,19 @@ fs_visitor::dead_code_eliminate()
>
> if (inst->dst.file == GRF) {
> if (!inst->is_partial_write()) {
> - int var = live_intervals->var_from_vgrf[inst->dst.reg];
> + int var = live_intervals->var_from_reg(&inst->dst);
> for (int i = 0; i < inst->regs_written; i++) {
> - BITSET_CLEAR(live, var + inst->dst.reg_offset + i);
> + BITSET_CLEAR(live, var + i);
> }
This hunk seems fine.
> }
> }
>
> for (int i = 0; i < inst->sources; i++) {
> if (inst->src[i].file == GRF) {
> - int var = live_intervals->var_from_vgrf[inst->src[i].reg];
> + int var = live_intervals->var_from_reg(&inst->src[i]);
>
> for (int j = 0; j < inst->regs_read(this, i); j++) {
> - BITSET_SET(live, var + inst->src[i].reg_offset + j);
> + BITSET_SET(live, var + j);
I think this is also fine.
More information about the mesa-dev
mailing list