<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 - FTL should use AI more"
   href="https://bugs.webkit.org/show_bug.cgi?id=144500">144500</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>FTL should use AI more
          </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>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </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>fpizlo&#64;apple.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Currently if a DFG Node semantically requires a check, and we know that the check is redundant, then one of three things happen in the FTL backend:

1) If the check is part of the edge, then we will correctly remove it and not emit any LLVM IR for the check.

2) If the check is the only thing that the node does, and AI knows this, then ConstantFoldingPhase will remove the node before we get to the backend.

3) If the node does many things and also the check (or AI just doesn't know about the check), then we will emit LLVM IR for the check.  In many (most?) cases, LLVM will not remove the check because it will involve things opaque to LLVM - like loading the type part of the object's header.

An easy simplification is to have all of the isNumber/isCell/isBlah things in FTL::LowerDFGToLLVM have a mode where they return an LLVM constant if we have already proved that the incoming value either is, or isn't, the type in question.  This will be slightly less effective than (1) or (2) since we will still emit control flow for the unreachable path, but in the end LLVM will prove this control flow unreachable and kill the code - so it's much better than falling over to (3).</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>