[llvm-bugs] [Bug 36879] New: [LTO] convert math LLVM intrinsics into finite version of libcalls

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Mar 23 09:04:45 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=36879

            Bug ID: 36879
           Summary: [LTO] convert math LLVM intrinsics into finite version
                    of libcalls
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: denis.bakhvalov at intel.com
                CC: llvm-bugs at lists.llvm.org

Spawned form https://bugs.llvm.org/show_bug.cgi?id=35672

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 at 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 at 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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180323/95288992/attachment.html>


More information about the llvm-bugs mailing list