Commit a5eecb24 authored by Paul Berry's avatar Paul Berry

glsl: Handle empty if statement encountered during loop analysis.

The is_loop_terminator() function was asserting that the following
kind of if statement could never occur:

    if (...) { } else { }

(presumably based on the assumption that such an if statement would be
eliminated by previous optimization stages).  But that isn't the
case--it's possible that previous optimization stages might simplify
more complex code down to this empty if statement, in which case it
won't be eliminated until the next time through the optimization loop.

So is_loop_terminator() needs to handle it.  Fortunately it's easy to
handle--it's not a loop terminator because it does nothing.

Reviewed-by: default avatarKenneth Graunke <>
parent b8f13fbb
......@@ -503,7 +503,8 @@ is_loop_terminator(ir_if *ir)
ir_instruction *const inst =
(ir_instruction *) ir->then_instructions.get_head();
assert(inst != NULL);
if (inst == NULL)
return false;
if (inst->ir_type != ir_type_loop_jump)
return false;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment