This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] use __builtin_isnan in std::isnan.
ClosedPublic

Authored by TokarIP on Nov 4 2019, 8:54 AM.

Details

Summary

This allows std::isnan to be fully inlined, instead of generating calls.

Diff Detail

Event Timeline

TokarIP created this revision.Nov 4 2019, 8:54 AM

OK, this LGTM.

The C library header tries to perform this optimization for us, but it fails to detect that Clang has __builtin_isnan because it reports as GCC 4.2, and the C library checks for GCC 4.4.

It's unfortunate we need to do this ourselves, but I'm OK making this change.

Since the __libcpp_is_nan_or_builtin hacks are no longer needed (they can directly call isnan), could you please send a separate change to remove it?

EricWF accepted this revision.Nov 15 2019, 9:01 AM

Sorry, I meant to LGTM this formally last time.

This revision is now accepted and ready to land.Nov 15 2019, 9:01 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptNov 15 2019, 9:38 AM