This is an archive of the discontinued LLVM Phabricator instance.

[libc++][math.h] Remove unnecessary uses of __promote
ClosedPublic

Authored by philnik on Oct 27 2022, 11:03 AM.

Details

Reviewers
ldionne
Group Reviewers
Restricted Project
Commits
rGf7b8f7273b0e: [libc++][math.h] Remove unnecessary uses of __promote
Summary

Removes __promote when it's just the identity.

Diff Detail

Event Timeline

philnik created this revision.Oct 27 2022, 11:03 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 27 2022, 11:03 AM
philnik requested review of this revision.Oct 27 2022, 11:03 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 27 2022, 11:03 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
ldionne accepted this revision.Oct 27 2022, 12:03 PM
This revision is now accepted and ready to land.Oct 27 2022, 12:03 PM
This revision was automatically updated to reflect the committed changes.
EricWF added a subscriber: EricWF.Oct 28 2022, 10:57 AM

What happens here with __fp16 or other extended floating point types.
Users have been known to specialize is_floating_point to make these things work.

What happens here with __fp16 or other extended floating point types.
Users have been known to specialize is_floating_point to make these things work.

Users are not allowed to do that because __fp16 is not a user-defined type, so they can't specialize a type trait in namespace std AFAICT. And if someone did do that, TBH it would be broken in way more ways than just this.

IMO the path forward here for custom floating point types is to do http://wg21.link/p1467 and consider the problem in its entirety.

Just wondering -- did you notice any issues caused by this change specifically?

Yes. There are older version of this library that override
is_floating_point for the half type it provides.
Though it looks like newer versions have a different approach.
https://sourceforge.net/projects/half/