[PATCH] D25403: [CUDA] Mark __libcpp_{isnan, isinf, isfinite} as constexpr.

Justin Lebar via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 26 15:55:42 PDT 2016


jlebar added a comment.

In https://reviews.llvm.org/D25403#580422, @hfinkel wrote:

> Okay. Why not fix the Clang builtins so that they're evaluatable for constant inputs in a constexpr context? Then we can do this and test the change.


I am not sure how much value we would derive from testing specifically that these functions are constexpr-evaluatable?  The thing we actually care about is whether clang can wrap the libc++ `<complex>` header in cuda mode, and that could break by removing these constexprs, or by adding a new function used in `<complex>` and not marking it constexpr, or in any number of other ways.

Conversely, if `<complex>` stopped relying on these functions, we wouldn't care if they stopped being constexpr.

In addition, if I understand you correctly, we wouldn't be able to test all of the functions here, only the ones that call builtins.

We have an e2e test for this in the test-suite -- it's currently only enabled for libstdc++.  We haven't yet hooked this up to send out emails when it fails, but if you wanted to block this change on that, I'd totally be onboard.  We also similarly have tests in the test-suite for <cmath> and <math.h>, which have similar failure modes to <complex>.


https://reviews.llvm.org/D25403





More information about the cfe-commits mailing list