Index: lib/Headers/__clang_cuda_runtime_wrapper.h =================================================================== --- lib/Headers/__clang_cuda_runtime_wrapper.h +++ lib/Headers/__clang_cuda_runtime_wrapper.h @@ -42,6 +42,13 @@ #if defined(__CUDA__) && defined(__clang__) +// The CUDA headers use the __USE_FAST_MATH__ macro to determine whether we get +// the slow-but-accurate or fast-but-inaccurate versions of functions like sin +// and exp, but -ffast-math defines only __FAST_MATH__. +#if defined(__FAST_MATH__) && !defined(__USE_FAST_MATH__) +#define __USE_FAST_MATH__ +#endif + // Include some forward declares that must come before cmath. #include <__clang_cuda_math_forward_declares.h>