-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Sema: Fix switch loop OPV cond lowering #24720
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
ca67759
to
007b0ee
Compare
|
007b0ee
to
fa1f54a
Compare
|
fa1f54a
to
291451a
Compare
291451a
to
6b28a6c
Compare
6b28a6c
to
5753e5e
Compare
Ok I believe I've found a much better solution to this problem now that can reuse most of the code that's already there and handles |
Special-cases runtime switches with a condition with one possible value or a singular else prong with no other prongs and lowers them to a regular `block`/`loop` instead of a `switch_br`/`loop_switch_br`.
5753e5e
to
acaa075
Compare
I managed to get rid of the |
that's no problem, I for one appreciate when someone takes the time to get it right. |
Resolves #21550
Resolves #24126
Resolves #21772
Special-cases runtime loops with a condition with one possible value and lowers them to a regular
loop
instead of aloop_switch_br
construct. Also covers a switch loop with a single else prong, see comment below.The implementation
is basically a simplified version ofomits any value corruption safety checks or prong branch hints.analyzeSwitchRuntimeBlock
and the code following it inzirSwitchBlock
that makes lots of assumptions andThis patch takes advantage of the symmetry between
loop_switch_br
-switch_dispatch
andloop
-repeat
and relies on backends being able to handle aloop
targeted by multiplerepeat
s. This pattern should be possible but has never been emitted by Sema until now.The added tests skip the self-hosted spirv backend because it doesn't support this pattern yet.
Also fixes a typo in Liveness.