<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Aug 24, 2017 at 8:16 AM, Juan A. Suarez Romero <span dir="ltr"><<a href="mailto:jasuarez@igalia.com" target="_blank">jasuarez@igalia.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">When a conditional branch has the same labels in the "if" part and in the<br>
"else" part, then we have the same cfg block, and it must be handled<br>
once.<br>
<br>
Fixes:<br>
dEQP-VK.spirv_assembly.<wbr>instruction.compute.<wbr>conditional_branch.same_<wbr>labels*<br>
dEQP-VK.spirv_assembly.<wbr>instruction.graphics.<wbr>conditional_branch.same_<wbr>labels*<br>
---<br>
 src/compiler/spirv/vtn_cfg.c | 7 +++++--<br>
 1 file changed, 5 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/compiler/spirv/vtn_cfg.c b/src/compiler/spirv/vtn_cfg.c<br>
index 03c452cb31..bfca7043cc 100644<br>
--- a/src/compiler/spirv/vtn_cfg.c<br>
+++ b/src/compiler/spirv/vtn_cfg.c<br>
@@ -356,8 +356,11 @@ vtn_cfg_walk_blocks(struct vtn_builder *b, struct list_head *cf_list,<br>
                                                   switch_case, switch_break,<br>
                                                   loop_break, loop_cont);<br>
<br>
-         if (if_stmt->then_type == vtn_branch_type_none &&<br>
-             if_stmt->else_type == vtn_branch_type_none) {<br>
+         if (then_block == else_block) {<br>
+            block = then_block;<br>
+            continue;<br></blockquote><div><br></div><div>This isn't quite sufficient.  This needs to be handled the same way as OpBranch.  In particular,</div><div><br></div><div>block->branch_type = if_stmt->then_type;</div><div>if (block->branch_type == vtn_branch_type_none) {</div><div>   block = then_block;</div><div>   continue;<br></div><div>} else {</div><div>   return;<br></div><div>}<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+         } else if (if_stmt->then_type == vtn_branch_type_none &&<br>
+                    if_stmt->else_type == vtn_branch_type_none) {<br>
             /* Neither side of the if is something we can short-circuit. */<br>
             assert((*block->merge & SpvOpCodeMask) == SpvOpSelectionMerge);<br>
             struct vtn_block *merge_block =<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.13.5<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>