From 5842829380166b3ff266121bc7131b238081f8cd Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 11 Sep 2023 11:10:30 -0700 Subject: [PATCH] intel/compiler: Limit scope of cur_endif variable Reviewed-by: Caio Oliveira Part-of: --- src/intel/compiler/brw_cfg.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/intel/compiler/brw_cfg.cpp b/src/intel/compiler/brw_cfg.cpp index 7245fcf651b..52e1e326b11 100644 --- a/src/intel/compiler/brw_cfg.cpp +++ b/src/intel/compiler/brw_cfg.cpp @@ -180,7 +180,6 @@ cfg_t::cfg_t(const backend_shader *s, exec_list *instructions) : bblock_t *entry = new_block(); bblock_t *cur_if = NULL; /**< BB ending with IF. */ bblock_t *cur_else = NULL; /**< BB ending with ELSE. */ - bblock_t *cur_endif = NULL; /**< BB starting with ENDIF. */ bblock_t *cur_do = NULL; /**< BB starting with DO. */ bblock_t *cur_while = NULL; /**< BB immediately following WHILE. */ exec_list if_stack, else_stack, do_stack, while_stack; @@ -206,7 +205,6 @@ cfg_t::cfg_t(const backend_shader *s, exec_list *instructions) : cur_if = cur; cur_else = NULL; - cur_endif = NULL; /* Set up our immediately following block, full of "then" * instructions. @@ -231,6 +229,8 @@ cfg_t::cfg_t(const backend_shader *s, exec_list *instructions) : break; case BRW_OPCODE_ENDIF: { + bblock_t *cur_endif; + if (cur->instructions.is_empty()) { /* New block was just created; use it. */ cur_endif = cur;