<html>
    <head>
      <base href="https://bugs.llvm.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 - [LTO] convert math LLVM intrinsics into finite version of libcalls"
   href="https://bugs.llvm.org/show_bug.cgi?id=36879">36879</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[LTO] convert math LLVM intrinsics into finite version of libcalls
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

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

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </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>LLVM Codegen
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>denis.bakhvalov@intel.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Spawned form <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - "[CodeGen] convert math libcalls/builtins to equivalent LLVM intrinsics" change overriding "__asm__ specifier"
   href="show_bug.cgi?id=35672">https://bugs.llvm.org/show_bug.cgi?id=35672</a>

The problem mentioned above was fixed but only for non-LTO builds. For LTO
build issue still exist.

$ cat a.c
#include <math.h>
int main()
{
  return exp(1.0);
}

1) Non-LTO build (notice call to '__exp_finite'):
$ clang -O0 -ffast-math a.c –lm
$ objdump -d a.out | grep "call.*exp"
  400567:   e8 c4 fe ff ff             callq  400430 <__exp_finite@plt> 

2) LTO build (notice call to 'exp'):
$ clang -O0 -flto -ffast-math a.c -lm
$ objdump -d a.out | grep "call.*exp"
  400547:   e8 b4 fe ff ff          callq  400400 <exp@plt>

We can see that if we add ‘-flto’ we stop generating the call to finite version
of ‘exp’ function, although we could, because ‘-ffast-math’ is provided.

I debugged this issue and found the root cause. I can share the details if
someone is interested, however I don’t know how it can be fixed immediately.</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>