SpirvShader: Fixes for complex loops.
Emit loops in forward direction. While traversing backwards from the loop back-edge means you don't have to worry about flowing down the merge block, it can lead to blocks being generated in orders that can break the visit-once logic.
Don't consider flows passing through the return block as a back edge.
Strip unreachable blocks from ins - nothing should ever consider them.
Tests: dEQP-VK.glsl.loops.*
Bug: b/
128527271
Change-Id: I497a06f5ce65d54b39294e4016b2df6d2c70487c
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/28188
Tested-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>