i965: Fix invalid pointer read in dead_control_flow_eliminate().
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 30 Mar 2016 19:00:02 +0000 (12:00 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 4 Apr 2016 21:34:40 +0000 (14:34 -0700)
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 <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_dead_control_flow.cpp

index 2c1abaf255cf4b06a2ee7ce787c245c70c588e6a..114dc6cb21240da5f3982160d27f8a2c151ac9d0 100644 (file)
@@ -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();