<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 --- - SimplifyLibCalls (in -instcombine) modifies all basic blocks in all functions in all modules"
   href="https://llvm.org/bugs/show_bug.cgi?id=26993">26993</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>SimplifyLibCalls (in -instcombine) modifies all basic blocks in all functions in all modules
          </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>Consider the following code:
--
define double @a() {
  %sin = call double @__sinpi(double 1.0)
  ret double %sin
}
define double @b() {
  %cos = call double @__cospi(double 1.0)
  ret double %cos
}

declare double @__sinpi(double %x) #0
declare double @__cospi(double %x) #0 

attributes #0 = { readnone nounwind }
--

Run -instcombine with r263853:
--
$ opt -instcombine -S -mtriple=x86_64-apple-macosx10.9
Instruction does not dominate all uses!
  %cospi = extractvalue { double, double } %sincospi, 1
  ret double %cospi
LLVM ERROR: Broken function found, compilation aborted!
--

The problem is that LibCallSimplifier::optimizeSinCosPi looks at all uses of
the constant.  This will affect not just other functions, but also all other
modules in the context.

I'm not sure -instcombine is even supposed to modify other basic blocks?</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>