[Mesa-dev] [PATCH 1/3] i965: Always set a valid block end pointer

Iago Toral Quiroga itoral at igalia.com
Tue May 27 03:50:14 PDT 2014


When a instruction stream ends in a block structure (like a IF/ELSE/ENDIF) the
last block's end pointer will not be set, leading to a crash later on in
fs_live_variables::setup_def_use().

If we have not assigned the end pointer of the last block, set it to the last
instruction.
---
 src/mesa/drivers/dri/i965/brw_cfg.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_cfg.cpp b/src/mesa/drivers/dri/i965/brw_cfg.cpp
index 6bf99f1..d4647c4 100644
--- a/src/mesa/drivers/dri/i965/brw_cfg.cpp
+++ b/src/mesa/drivers/dri/i965/brw_cfg.cpp
@@ -257,6 +257,11 @@ cfg_t::cfg_t(exec_list *instructions)
       }
    }
 
+   /* If the instruction stream ended with a block structure we need to
+      set the block's end pointer to the last instruction here */
+   if (!cur->end)
+      cur->end = (backend_instruction *)instructions->get_tail();
+
    cur->end_ip = ip;
 
    make_block_array();
-- 
1.9.1



More information about the mesa-dev mailing list