[Mesa-dev] [PATCH 11/11] glsl: Lower break instructions when necessary at the end of a loop.

Paul Berry stereotype441 at gmail.com
Wed Jul 6 16:41:51 PDT 2011


On 6 July 2011 12:18, Ian Romanick <idr at freedesktop.org> wrote:
>> +   /**
>> +    * If the block ends in a conditional or unconditional break, lower
>> +    * it, even though should_lower_jump() says it needn't be lowered.
>> +    */
>> +   void lower_final_breaks(exec_list *block)
>> +   {
>> +      ir_instruction *ir = (ir_instruction *) block->get_tail();
>> +      lower_break_unconditionally(ir);
>> +      ir_if *ir_if = ir->as_if();
>> +      lower_break_unconditionally(
>> +          (ir_instruction *) ir_if->then_instructions.get_tail());
>> +      lower_break_unconditionally(
>> +          (ir_instruction *) ir_if->else_instructions.get_tail());
>
> This looks suspicious.  How do we know that the tail of the block is
> always an if-statement?  If as_if returns NULL, this will explode.

Whoops, you're right of course.


More information about the mesa-dev mailing list