https://bugs.freedesktop.org/show_bug.cgi?id=101442
--- Comment #5 from Gert Wollny gw.fossdev@gmail.com --- With a bit more digging I found out that the sb optimizer simply drops the ELSE if no ALU instructions are found in the else branch, i.e.
while(cond1) if (cond2) { a = b + c; } else { break; } }
becomes
while(cond1) if (cond2) { a = b + c; break; } }
after the first sb/dce_cleanup pass, and this is obviously wrong. With the break in the if path this is not a problem. I'll attach two piglits that illustrate the behaviour.