mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/ir: Append code to the non-breaking branch if there is breaking one.
This commit is contained in:
parent
a2c6b5450b
commit
be7eec75dc
Notes:
Alexandre Julliard
2024-04-15 22:22:26 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Conor McCarthy (@cmccarthy) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/773
@ -4315,7 +4315,7 @@ static enum vkd3d_result vsir_cfg_optimize_recurse(struct vsir_cfg *cfg, struct
|
|||||||
|
|
||||||
for (i = 0; i < old_list.count; ++i)
|
for (i = 0; i < old_list.count; ++i)
|
||||||
{
|
{
|
||||||
struct vsir_cfg_structure *loop = &old_list.structures[i];
|
struct vsir_cfg_structure *loop = &old_list.structures[i], *selection;
|
||||||
struct vsir_cfg_structure_list *loop_body;
|
struct vsir_cfg_structure_list *loop_body;
|
||||||
|
|
||||||
if (loop->type != STRUCTURE_TYPE_LOOP)
|
if (loop->type != STRUCTURE_TYPE_LOOP)
|
||||||
@ -4346,6 +4346,22 @@ static enum vkd3d_result vsir_cfg_optimize_recurse(struct vsir_cfg *cfg, struct
|
|||||||
|
|
||||||
if ((ret = vsir_cfg_append_loop(cfg, new_list, loop)) < 0)
|
if ((ret = vsir_cfg_append_loop(cfg, new_list, loop)) < 0)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
/* If the last pushed instruction is a selection and one of the branches terminates with a
|
||||||
|
* `break', start pushing to the other branch, in the hope of eventually push a `break'
|
||||||
|
* there too and be able to remove a loop. */
|
||||||
|
if (new_list->count == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
selection = &new_list->structures[new_list->count - 1];
|
||||||
|
|
||||||
|
if (selection->type == STRUCTURE_TYPE_SELECTION)
|
||||||
|
{
|
||||||
|
if (vsir_cfg_get_trailing_break(&selection->u.selection.if_body))
|
||||||
|
new_list = &selection->u.selection.else_body;
|
||||||
|
else if (vsir_cfg_get_trailing_break(&selection->u.selection.else_body))
|
||||||
|
new_list = &selection->u.selection.if_body;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = VKD3D_OK;
|
ret = VKD3D_OK;
|
||||||
|
Loading…
Reference in New Issue
Block a user