[llvm-bugs] [Bug 35603] New: Missed optimization in math expression: sin(asin(a)) == a

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Dec 10 07:46:29 PST 2017


            Bug ID: 35603
           Summary: Missed optimization in math expression: sin(asin(a))
                    == a
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: zamazan4ik at tut.by
                CC: llvm-bugs at lists.llvm.org

clang(trunk) with '--std=c++17 -O3 -march=native -ffast-math' flags for this

#include <cmath>

double test(double a)
    return sin(asin(a));

generates this assembly:

test(double): # @test(double)
  push rax
  call __asin_finite
  pop rax
  jmp sin # TAILCALL

But sin(asin(a)) == a. So there is no reason to call anything.

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/20171210/f05246f5/attachment.html>

More information about the llvm-bugs mailing list