This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by gberry on May 5 2017, 1:03 PM.

Details

Summary

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

Event Timeline

gberry created this revision.May 5 2017, 1:03 PM

Ping? @hfinkel I believe you reviewed the change that introduced this check, any chance you'd like to review this refinement?

Ping? Any takers? This is a pretty simple change, it's mostly lit test updates.

hfinkel accepted this revision.Jun 12 2017, 8:45 AM

LGTM

This revision is now accepted and ready to land.Jun 12 2017, 8:45 AM
This revision was automatically updated to reflect the committed changes.