[Mesa-stable] [Mesa-dev] [PATCH] nir/spirv: Allow loop breaks in a switch body.
Jason Ekstrand
jason at jlekstrand.net
Mon Oct 2 04:06:55 UTC 2017
Dave just told me on IRC about the SPIR-V opt discussion:
https://github.com/KhronosGroup/SPIRV-Tools/issues/850
Assuming this actually solves the problem,
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
I would like to see CTS tests written for this and we had better die
horribly without this patch and pass with it. :-)
--Jason
On Sun, Oct 1, 2017 at 3:37 PM, Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
wrote:
> Per the SPIR-V spec 2.11 Structured Control Flow:
>
> "The only blocks in a construct that can branch outside the construct are
>
> ...
> - a break block for the innermost loop it is inside of.
> ..."
>
> With
>
> "Break block: A block containing a branch to the Merge Block of a loop
> header's merge instruction."
>
> Note that it puts no restriction on not being in an if or switch within
> the innermost loop.
>
> This passes the loop_break block to the switch body so it can properly
> detect loop breaks.
>
> CC: <mesa-stable at lists.freedesktop.org>
> ---
> src/compiler/spirv/vtn_cfg.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/compiler/spirv/vtn_cfg.c b/src/compiler/spirv/vtn_cfg.c
> index 3ad20b9ad83..25ff254bcec 100644
> --- a/src/compiler/spirv/vtn_cfg.c
> +++ b/src/compiler/spirv/vtn_cfg.c
> @@ -435,7 +435,7 @@ vtn_cfg_walk_blocks(struct vtn_builder *b, struct
> list_head *cf_list,
> list_for_each_entry(struct vtn_case, cse, &swtch->cases, link) {
> assert(cse->start_block != break_block);
> vtn_cfg_walk_blocks(b, &cse->body, cse->start_block, cse,
> - break_block, NULL, loop_cont, NULL);
> + break_block, loop_break, loop_cont, NULL);
> }
>
> /* Finally, we walk over all of the cases one more time and put
> --
> 2.14.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-stable/attachments/20171001/f6a24ae7/attachment.html>
More information about the mesa-stable
mailing list