diff --git a/src/intel/compiler/brw_shader.cpp b/src/intel/compiler/brw_shader.cpp index bf12c95d01f..bbca3483371 100644 --- a/src/intel/compiler/brw_shader.cpp +++ b/src/intel/compiler/brw_shader.cpp @@ -1153,11 +1153,16 @@ backend_instruction::is_volatile() const static bool inst_is_in_block(const bblock_t *block, const backend_instruction *inst) { - foreach_inst_in_block (backend_instruction, i, block) { - if (inst == i) - return true; - } - return false; + const exec_node *n = inst; + + /* Find the tail sentinel. If the tail sentinel is the sentinel from the + * list header in the bblock_t, then this instruction is in that basic + * block. + */ + while (!n->is_tail_sentinel()) + n = n->get_next(); + + return n == &block->instructions.tail_sentinel; } #endif