[PATCH] D32921: [SelectionDAG] Allow sin/cos -> sincos optimization on GNU triples w/ just -fno-math-errno

Geoff Berry via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 5 13:03:52 PDT 2017


gberry created this revision.
Herald added subscribers: javed.absar, mcrosier.

This change enables the sin(x) cos(x) -> sincos(x) optimization on GNU
target triples.  This optimization was being inhibited when -ffast-math
wasn't set because sincos in GLibC does not set errno, while sin and cos
do.  However, this optimization will only run if the attributes on the
sin/cos calls include readnone, which is how clang represents the fact
that it doesn't care about the errno values set by these functions (via
the -fno-math-errno flag).


https://reviews.llvm.org/D32921

Files:
  lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
  test/CodeGen/AArch64/arm64-sincos.ll
  test/CodeGen/AArch64/sincos-expansion.ll
  test/CodeGen/ARM/sincos.ll
  test/CodeGen/SystemZ/fp-sincos-01.ll
  test/CodeGen/X86/sincos-opt.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32921.98006.patch
Type: text/x-patch
Size: 18133 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170505/210c3fd3/attachment.bin>


More information about the llvm-commits mailing list