[Mesa-dev] [PATCH 2/2] i965/cfg: Remove if_block/else_block.

Jason Ekstrand jason at jlekstrand.net
Tue Nov 11 06:58:42 PST 2014


Both patches are Reviewed-by: Jason Ekstrand <jason.ekstrand at intel.com>
On Nov 10, 2014 11:37 PM, "Matt Turner" <mattst88 at gmail.com> wrote:

> I used these in the SEL peephole, but they require extra tracking and
> fix ups. The SEL peephole can pretty easily find the blocks it needs
> without these.
> ---
>  src/mesa/drivers/dri/i965/brw_cfg.cpp               | 15 +--------------
>  src/mesa/drivers/dri/i965/brw_cfg.h                 |  8 --------
>  src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp |  8 --------
>  3 files changed, 1 insertion(+), 30 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_cfg.cpp
> b/src/mesa/drivers/dri/i965/brw_cfg.cpp
> index bb49a0a..02149e2 100644
> --- a/src/mesa/drivers/dri/i965/brw_cfg.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_cfg.cpp
> @@ -51,8 +51,7 @@ link(void *mem_ctx, bblock_t *block)
>  }
>
>  bblock_t::bblock_t(cfg_t *cfg) :
> -   cfg(cfg), start_ip(0), end_ip(0), num(0),
> -   if_block(NULL), else_block(NULL)
> +   cfg(cfg), start_ip(0), end_ip(0), num(0)
>  {
>     instructions.make_empty();
>     parents.make_empty();
> @@ -136,7 +135,6 @@ bblock_t::combine_with(bblock_t *that)
>     }
>
>     this->end_ip = that->end_ip;
> -   this->else_block = that->else_block;
>     this->instructions.append_list(&that->instructions);
>
>     this->cfg->remove_block(that);
> @@ -238,17 +236,6 @@ cfg_t::cfg_t(exec_list *instructions)
>           assert(cur_if->end()->opcode == BRW_OPCODE_IF);
>           assert(!cur_else || cur_else->end()->opcode == BRW_OPCODE_ELSE);
>
> -         cur_if->if_block = cur_if;
> -         cur_if->else_block = cur_else;
> -
> -        if (cur_else) {
> -            cur_else->if_block = cur_if;
> -            cur_else->else_block = cur_else;
> -         }
> -
> -         cur->if_block = cur_if;
> -         cur->else_block = cur_else;
> -
>          /* Pop the stack so we're in the previous if/else/endif */
>          cur_if = pop_stack(&if_stack);
>          cur_else = pop_stack(&else_stack);
> diff --git a/src/mesa/drivers/dri/i965/brw_cfg.h
> b/src/mesa/drivers/dri/i965/brw_cfg.h
> index 388d29e..48bca9f 100644
> --- a/src/mesa/drivers/dri/i965/brw_cfg.h
> +++ b/src/mesa/drivers/dri/i965/brw_cfg.h
> @@ -89,14 +89,6 @@ struct bblock_t {
>     struct exec_list parents;
>     struct exec_list children;
>     int num;
> -
> -   /* If the current basic block ends in an IF or ELSE instruction, these
> will
> -    * point to the basic blocks containing the other associated
> instruction.
> -    *
> -    * Otherwise they are NULL.
> -    */
> -   struct bblock_t *if_block;
> -   struct bblock_t *else_block;
>  };
>
>  static inline struct backend_instruction *
> diff --git a/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp
> b/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp
> index 4c9d7b9..03f838d 100644
> --- a/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp
> @@ -85,7 +85,6 @@ dead_control_flow_eliminate(backend_visitor *v)
>           }
>
>           if (else_inst) {
> -            else_block->if_block->else_block = NULL;
>              else_inst->remove(else_block);
>           }
>
> @@ -102,13 +101,6 @@ dead_control_flow_eliminate(backend_visitor *v)
>           if (earlier_block &&
> earlier_block->can_combine_with(later_block)) {
>              earlier_block->combine_with(later_block);
>
> -            foreach_block (block, v->cfg) {
> -               if (block->if_block == later_block)
> -                  block->if_block = earlier_block;
> -               if (block->else_block == later_block)
> -                  block->else_block = earlier_block;
> -            }
> -
>              /* If ENDIF was in its own block, then we've now deleted it
> and
>               * merged the two surrounding blocks, the latter of which the
>               * __next block pointer was pointing to.
> --
> 2.0.4
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20141111/bec41af4/attachment.html>


More information about the mesa-dev mailing list