<div dir="ltr">Yes in both cases. We're still exploring things in this design space, though. The main place where we care about irreducible control flow is in interpreter loops, and we'd like to make sure these can also be efficient.</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 6, 2015 at 4:12 PM, Rafael Espíndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">Out of curiosity, why does Webassembly require structured control flow? To make it easier to lower to js? Is that something you want to change in the future? </p><div class="HOEnZb"><div class="h5">
<div class="gmail_quote">On Jul 6, 2015 5:44 PM, "JF Bastien" <<a href="mailto:jfb@google.com" target="_blank">jfb@google.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: jfb<br>
Date: Mon Jul  6 16:41:59 2015<br>
New Revision: 241513<br>
<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D241513-26view-3Drev&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=B4BAruL07Wd38XeI1iTfORabgXdCmW0_prvjbFuK_8A&s=4ZV7cPg2GfeiYwLtNIiPH0GUBqGl8CwnbZPygBA5UM0&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=241513&view=rev</a><br>
Log:<br>
WebAssembly: add some TODO<br>
<br>
Reviewers: sunfish<br>
<br>
Subscribers: llvm-commits, jfb<br>
<br>
Differential Revision: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D10971&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=B4BAruL07Wd38XeI1iTfORabgXdCmW0_prvjbFuK_8A&s=DLiAALASAGWoLkUjOy8IfuhpJ4EesnXPf17RhTwabq0&e=" rel="noreferrer" target="_blank">http://reviews.llvm.org/D10971</a><br>
<br>
Modified:<br>
    llvm/trunk/lib/Target/WebAssembly/README.txt<br>
<br>
Modified: llvm/trunk/lib/Target/WebAssembly/README.txt<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_Target_WebAssembly_README.txt-3Frev-3D241513-26r1-3D241512-26r2-3D241513-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=B4BAruL07Wd38XeI1iTfORabgXdCmW0_prvjbFuK_8A&s=2KjTzdmiUTo_SXQiqJKmFuH3cpjYAgVg2fluO61DxSg&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/README.txt?rev=241513&r1=241512&r2=241513&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/WebAssembly/README.txt (original)<br>
+++ llvm/trunk/lib/Target/WebAssembly/README.txt Mon Jul  6 16:41:59 2015<br>
@@ -12,4 +12,15 @@ binary encoding of WebAssembly itself:<br>
   * <a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_WebAssembly_design_blob_master_AstSemantics.md&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=B4BAruL07Wd38XeI1iTfORabgXdCmW0_prvjbFuK_8A&s=X32PzF5OeAPK7CSs3e3miUMNDzU2k5yPCITNTLr_A2A&e=" rel="noreferrer" target="_blank">https://github.com/WebAssembly/design/blob/master/AstSemantics.md</a><br>
   * <a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_WebAssembly_design_blob_master_BinaryEncoding.md&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=B4BAruL07Wd38XeI1iTfORabgXdCmW0_prvjbFuK_8A&s=T41yQCy3eDv7OhgdZmHzFwFnbO0pK_4PM00z--L0vEQ&e=" rel="noreferrer" target="_blank">https://github.com/WebAssembly/design/blob/master/BinaryEncoding.md</a><br>
<br>
+Interesting work that remains to be done:<br>
+* Write a pass to restructurize irreducible control flow. This needs to be done<br>
+  before register allocation to be efficient, because it may duplicate basic<br>
+  blocks and WebAssembly performs register allocation at a whole-function<br>
+  level. Note that LLVM's GPU code has such a pass, but it linearizes control<br>
+  flow (e.g. both sides of branches execute and are masked) which is undesirable<br>
+  for WebAssembly.<br>
+* Basic relooper to expose control flow as an AST.<br>
+* Figure out how to properly use MC for virtual ISAs. This may require some<br>
+  refactoring of MC.<br>
+<br>
 //===---------------------------------------------------------------------===//<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>
</div></div></blockquote></div><br></div>