<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - LibCallSimplifier::optimizeSinCosPi walks through all users of a ConstantFP"
   href="https://llvm.org/bugs/show_bug.cgi?id=30557">30557</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LibCallSimplifier::optimizeSinCosPi walks through all users of a ConstantFP
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </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>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Transformation Utilities
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>dexonsmith@apple.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=17375" name="attach_17375" title="Patch to stop optimizing sinpi/cospi of a ConstantFP into sincospi.">attachment 17375</a> <a href="attachment.cgi?id=17375&action=edit" title="Patch to stop optimizing sinpi/cospi of a ConstantFP into sincospi.">[details]</a></span>
Patch to stop optimizing sinpi/cospi of a ConstantFP into sincospi.

LibCallSimplifier::optimizeSinCosPi walks through all users of the arguments in
calls to @llvm.cospi and @llvm.sinpi.  Since these arguments might be
ConstantFP, which is owned by the context, this could take an arbitrarily long
time.

Moreover, this is blocking the removal of use-lists from ConstantData in <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - ConstantData should not have use-lists"
   href="show_bug.cgi?id=30513">bug
30513</a>.

There are a few possible solutions:
- Stop performing this optimization on ConstantData (i.e., ConstantFP).  I've
attached a patch that does this, but I doubt it's really what we want.
- Move this optimization to its own pass that walks through the instructions in
a function and keeps a map of the cospi/sinpi calls it has found so far, lazily
replacing them with sincospi when it gets to a matching pair.
- Move this optimization to a similar pass and add this functionality.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>