On Thu, 2019-03-14 at 11:25 -0500, Jason Ekstrand wrote: > Looking at this a bit more, I'm not sure that just short-circuiting actually > covers all the cases. Unfortunately, we don't know what all the cases are > because the SPIR-V spec doesn't say. I'm trying to work towards fixing that > right now. > >
Did you have time to check this? J.A. > --Jason > > > On Wed, Mar 6, 2019 at 5:25 AM Juan A. Suarez Romero <jasua...@igalia.com> > wrote: > > This fixes the case when the SPIR-V code has two nested conditional > > > > branches, but only one selection merge: > > > > > > > > [...] > > > > %1 = OpLabel > > > > OpSelectionMerge %2 None > > > > OpBranchConditional %3 %4 %2 > > > > %4 = OpLabel > > > > OpBranchConditional %3 %5 %2 > > > > %5 = OpLabel > > > > OpBranch %2 > > > > %2 = OpLabel > > > > [...] > > > > > > > > In the second OpBranchConditional, as the else-part is the end > > > > block (started in the first OpBranchConditional) we can just follow the > > > > then-part. > > > > > > > > This fixes dEQP-VK.vkrunner.controlflow.2-obc-triangle-triangle > > > > > > > > CC: Jason Ekstrand <ja...@jlekstrand.net> > > > > --- > > > > src/compiler/spirv/vtn_cfg.c | 11 ++++++++++- > > > > 1 file changed, 10 insertions(+), 1 deletion(-) > > > > > > > > diff --git a/src/compiler/spirv/vtn_cfg.c b/src/compiler/spirv/vtn_cfg.c > > > > index 7868eeb60bc..f749118efbe 100644 > > > > --- a/src/compiler/spirv/vtn_cfg.c > > > > +++ b/src/compiler/spirv/vtn_cfg.c > > > > @@ -605,7 +605,16 @@ vtn_cfg_walk_blocks(struct vtn_builder *b, struct > > list_head *cf_list, > > > > } > > > > } else if (if_stmt->then_type == vtn_branch_type_none && > > > > if_stmt->else_type == vtn_branch_type_none) { > > > > - /* Neither side of the if is something we can short-circuit. */ > > > > + /* Neither side of the if is something we can short-circuit, > > > > + * unless one of the blocks is the end block. */ > > > > + if (then_block == end) { > > > > + block = else_block; > > > > + continue; > > > > + } else if (else_block == end) { > > > > + block = then_block; > > > > + continue; > > > > + } > > > > + > > > > vtn_assert((*block->merge & SpvOpCodeMask) == > > SpvOpSelectionMerge); > > > > struct vtn_block *merge_block = > > > > vtn_value(b, block->merge[1], vtn_value_type_block)->block; > >
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev