<div dir="ltr">Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 11, 2017 at 2:41 AM, Samuel Iglesias Gonsálvez <span dir="ltr"><<a href="mailto:siglesias@igalia.com" target="_blank">siglesias@igalia.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: "Juan A. Suarez Romero" <<a href="mailto:jasuarez@igalia.com">jasuarez@igalia.com</a>><br>
<span class=""><br>
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>
</span>v2: handle it the same way as OpBranch (Jason).<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 | 12 ++++++++++--<br>
1 file changed, 10 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/compiler/spirv/vtn_cfg.c b/src/compiler/spirv/vtn_cfg.c<br>
index 03c452cb31..3ad20b9ad8 100644<br>
--- a/src/compiler/spirv/vtn_cfg.c<br>
+++ b/src/compiler/spirv/vtn_cfg.c<br>
@@ -356,8 +356,16 @@ vtn_cfg_walk_blocks(struct vtn_builder *b, struct list_head *cf_list,<br>
<span class=""> 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>
</span>+ block->branch_type = if_stmt->then_type;<br>
+ if (block->branch_type == vtn_branch_type_none) {<br>
<span class="">+ block = then_block;<br>
+ continue;<br>
</span>+ } else {<br>
+ return;<br>
+ }<br>
<span class="">+ } 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>
--<br>
</span>2.14.1<br>
<br>
</blockquote></div><br></div>