Handle nested breaks from switches. (#2624)
* Handle nested breaks from switches. There was a recent decision made to allow branches to the merge node of a switch even if the switch is not the first enclosing construct. They can be generated by glslang from break statements in switches. Dead branch elimination seems to be the only optimization that will break because of this change, so I will update that optimizations. The change made are: - Track switches in structured cfg analysis. - In Dead branch elimination: - Look for nested breaks that will require a switch instruction. - Rewrite, but don't delete, switchs that are required even if it could be replaced by an unconditional branch. - When looking for the first break, consider the merge of a switch as well. See #2612. * Fix variable names and comments. * Add tests for the struct cfg analysis and switches. * Fix typos in comments.
Loading
Please register or sign in to comment