<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Better optimize 'if' with ternaries conditional tests."
   href="https://bugs.webkit.org/show_bug.cgi?id=144136">144136</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Better optimize 'if' with ternaries conditional tests.
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>WebKit
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>528+ (Nightly build)
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Unspecified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Unspecified
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>Normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P2
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>JavaScriptCore
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>webkit-unassigned&#64;lists.webkit.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>dtc-llvm&#64;scieneer.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>For asm.js code it is very important to optimize an 'if' statement with a '?' ternaries conditional. Asm.js does not support &amp;&amp; and || and Emscripten has for some time optimized these patterns to &quot;a?b:0&quot; for &quot;a&amp;&amp;b&quot; and &quot;a?1:b&quot; for &quot;a||b&quot;. JSC FTL does not seem to optimize 'if (a?b:0)' well and produces much faster code for 'if(a &amp;&amp; b)' or 'if (a) if(b)' - it almost doubles the run time for the zlib benchmark. This might not be noticed in old asm.js code which did not use these patterns, but the Emscripten 'simplifyIfs' optimization has been in use for some time now. There might be some other patterns that could be optimized too. The Odin support might be a good reference, see <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=919052">https://bugzilla.mozilla.org/show_bug.cgi?id=919052</a></pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>