+ /* Removing the last instruction from a basic block removes the block as
+ * well, so put a NOP at the end to keep it alive.
+ */
+ if (!block->end()->is_control_flow()) {
+ backend_instruction *nop = new(mem_ctx) backend_instruction();
+ nop->opcode = BRW_OPCODE_NOP;
+ block->end()->insert_after(block, nop);
+ }
+
+ foreach_inst_in_block_safe(backend_instruction, inst, block) {
+ if (inst->opcode == BRW_OPCODE_NOP || inst->is_control_flow())
+ continue;