aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2016-03-30 12:00:02 -0700
committerKenneth Graunke <[email protected]>2016-04-04 14:34:40 -0700
commitda5d08707bf07c76b6a1851f3a36bb7c1f8d4d4b (patch)
tree5aef844868cae28379d4e5f2f11ca5e4c6942098 /src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp
parent9486614938035f6bec746d207a9cf79a7def0724 (diff)
i965: Fix invalid pointer read in dead_control_flow_eliminate().
There may not be a previous block. In this case, there's no real work to do, so just continue on to the next one. v2: Update for bblock->prev() API change. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp')
-rw-r--r--src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp4
1 files changed, 4 insertions, 0 deletions
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 2c1abaf255c..114dc6cb212 100644
--- a/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp
+++ b/src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp
@@ -42,6 +42,10 @@ dead_control_flow_eliminate(backend_shader *s)
foreach_block_safe (block, s->cfg) {
bblock_t *prev_block = block->prev();
+
+ if (!prev_block)
+ continue;
+
backend_instruction *const inst = block->start();
backend_instruction *const prev_inst = prev_block->end();