r356255 - [CUDA][Windows] Partial fix for bug #38811 (Step 1 of 3)
Author: emankov Date: Fri Mar 15 05:05:36 2019 New Revision: 356255 URL: http://llvm.org/viewvc/llvm-project?rev=356255&view=rev Log: [CUDA][Windows] Partial fix for bug #38811 (Step 1 of 3) Partial fix for the clang Bug https://bugs.llvm.org/show_bug.cgi?id=38811 "Clang fails to compile with CUDA-9.x on Windows". Adding defined(_WIN64) check along with existing #if defined(__LP64__) eliminates the below clang (64-bit) compilation error on Windows. C:/GIT/LLVM/trunk/llvm-64-release-vs2017/dist/lib/clang/9.0.0\include\__clang_cuda_device_functions.h(1609,45): error GEF7559A7: no matching function for call to 'roundf' __DEVICE__ long lroundf(float __a) { return roundf(__a); } Reviewed by: Artem Belevich Differential Revision: http://reviews.llvm.org/D59361 Modified: cfe/trunk/lib/Headers/__clang_cuda_device_functions.h Modified: cfe/trunk/lib/Headers/__clang_cuda_device_functions.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/__clang_cuda_device_functions.h?rev=356255&r1=356254&r2=356255&view=diff == --- cfe/trunk/lib/Headers/__clang_cuda_device_functions.h (original) +++ cfe/trunk/lib/Headers/__clang_cuda_device_functions.h Fri Mar 15 05:05:36 2019 @@ -1563,7 +1563,7 @@ __DEVICE__ double j1(double __a) { retur __DEVICE__ float j1f(float __a) { return __nv_j1f(__a); } __DEVICE__ double jn(int __n, double __a) { return __nv_jn(__n, __a); } __DEVICE__ float jnf(int __n, float __a) { return __nv_jnf(__n, __a); } -#if defined(__LP64__) +#if defined(__LP64__) || defined(_WIN64) __DEVICE__ long labs(long __a) { return llabs(__a); }; #else __DEVICE__ long labs(long __a) { return __nv_abs(__a); }; @@ -1597,7 +1597,7 @@ __DEVICE__ float logbf(float __a) { retu __DEVICE__ float logf(float __a) { return __FAST_OR_SLOW(__nv_fast_logf, __nv_logf)(__a); } -#if defined(__LP64__) +#if defined(__LP64__) || defined(_WIN64) __DEVICE__ long lrint(double __a) { return llrint(__a); } __DEVICE__ long lrintf(float __a) { return __float2ll_rn(__a); } __DEVICE__ long lround(double __a) { return llround(__a); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r356291 - [CUDA][Windows] Partial fix for bug 38811 (Step 2 of 3)
Author: emankov Date: Fri Mar 15 12:04:46 2019 New Revision: 356291 URL: http://llvm.org/viewvc/llvm-project?rev=356291&view=rev Log: [CUDA][Windows] Partial fix for bug 38811 (Step 2 of 3) Partial fix for the clang Bug 38811 "Clang fails to compile with CUDA-9.x on Windows". [Synopsis] __sptr is a new Microsoft specific modifier (https://docs.microsoft.com/en-us/cpp/cpp/sptr-uptr?view=vs-2017). [Solution] Replace all `__sptr` occurrences with `__s` (and all `__cptr` with `__c` as well) to eliminate the below clang compilation error on Windows. In file included from C:\GIT\LLVM\trunk\llvm-64-release-vs2017-15.9.5\dist\lib\clang\9.0.0\include\__clang_cuda_runtime_wrapper.h:162: C:\GIT\LLVM\trunk\llvm-64-release-vs2017-15.9.5\dist\lib\clang\9.0.0\include\__clang_cuda_device_functions.h:524:33: error: expected expression return __nv_fast_sincosf(__a, __sptr, __cptr); ^ Reviewed by: Artem Belevich Differential Revision: http://reviews.llvm.org/D59423 Modified: cfe/trunk/lib/Headers/__clang_cuda_device_functions.h cfe/trunk/lib/Headers/__clang_cuda_libdevice_declares.h Modified: cfe/trunk/lib/Headers/__clang_cuda_device_functions.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/__clang_cuda_device_functions.h?rev=356291&r1=356290&r2=356291&view=diff == --- cfe/trunk/lib/Headers/__clang_cuda_device_functions.h (original) +++ cfe/trunk/lib/Headers/__clang_cuda_device_functions.h Fri Mar 15 12:04:46 2019 @@ -520,8 +520,8 @@ __DEVICE__ unsigned int __sad(int __a, i __DEVICE__ float __saturatef(float __a) { return __nv_saturatef(__a); } __DEVICE__ int __signbitd(double __a) { return __nv_signbitd(__a); } __DEVICE__ int __signbitf(float __a) { return __nv_signbitf(__a); } -__DEVICE__ void __sincosf(float __a, float *__sptr, float *__cptr) { - return __nv_fast_sincosf(__a, __sptr, __cptr); +__DEVICE__ void __sincosf(float __a, float *__s, float *__c) { + return __nv_fast_sincosf(__a, __s, __c); } __DEVICE__ float __sinf(float __a) { return __nv_fast_sinf(__a); } __DEVICE__ int __syncthreads_and(int __a) { return __nvvm_bar0_and(__a); } @@ -1713,17 +1713,17 @@ __DEVICE__ float scalblnf(float __a, lon return scalbnf(__a, (int)__b); } __DEVICE__ double sin(double __a) { return __nv_sin(__a); } -__DEVICE__ void sincos(double __a, double *__sptr, double *__cptr) { - return __nv_sincos(__a, __sptr, __cptr); +__DEVICE__ void sincos(double __a, double *__s, double *__c) { + return __nv_sincos(__a, __s, __c); } -__DEVICE__ void sincosf(float __a, float *__sptr, float *__cptr) { - return __FAST_OR_SLOW(__nv_fast_sincosf, __nv_sincosf)(__a, __sptr, __cptr); +__DEVICE__ void sincosf(float __a, float *__s, float *__c) { + return __FAST_OR_SLOW(__nv_fast_sincosf, __nv_sincosf)(__a, __s, __c); } -__DEVICE__ void sincospi(double __a, double *__sptr, double *__cptr) { - return __nv_sincospi(__a, __sptr, __cptr); +__DEVICE__ void sincospi(double __a, double *__s, double *__c) { + return __nv_sincospi(__a, __s, __c); } -__DEVICE__ void sincospif(float __a, float *__sptr, float *__cptr) { - return __nv_sincospif(__a, __sptr, __cptr); +__DEVICE__ void sincospif(float __a, float *__s, float *__c) { + return __nv_sincospif(__a, __s, __c); } __DEVICE__ float sinf(float __a) { return __FAST_OR_SLOW(__nv_fast_sinf, __nv_sinf)(__a); Modified: cfe/trunk/lib/Headers/__clang_cuda_libdevice_declares.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/__clang_cuda_libdevice_declares.h?rev=356291&r1=356290&r2=356291&view=diff == --- cfe/trunk/lib/Headers/__clang_cuda_libdevice_declares.h (original) +++ cfe/trunk/lib/Headers/__clang_cuda_libdevice_declares.h Fri Mar 15 12:04:46 2019 @@ -141,7 +141,7 @@ __device__ float __nv_fast_log10f(float __device__ float __nv_fast_log2f(float __a); __device__ float __nv_fast_logf(float __a); __device__ float __nv_fast_powf(float __a, float __b); -__device__ void __nv_fast_sincosf(float __a, float *__sptr, float *__cptr); +__device__ void __nv_fast_sincosf(float __a, float *__s, float *__c); __device__ float __nv_fast_sinf(float __a); __device__ float __nv_fast_tanf(float __a); __device__ double __nv_fdim(double __a, double __b); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r357779 - [CUDA][Windows] Last fix for the clang Bug 38811 "Clang fails to compile with CUDA-9.x on Windows" (https://bugs.llvm.org/show_bug.cgi?id=38811).
Author: emankov Date: Fri Apr 5 09:51:10 2019 New Revision: 357779 URL: http://llvm.org/viewvc/llvm-project?rev=357779&view=rev Log: [CUDA][Windows] Last fix for the clang Bug 38811 "Clang fails to compile with CUDA-9.x on Windows" (https://bugs.llvm.org/show_bug.cgi?id=38811). [IMPORTANT] With that last fix, CUDA has just started being compiling by clang on Windows after nearly a year and two clang’s major releases (7 and 8). As long as the last LLVM release, in which clang was compiling CUDA on Windows successfully, was 6.0.1, this fix and two previous have to be included into upcoming 7.1.0 and 8.0.1 releases. [How to repro] clang++.exe -x cuda "c:\ProgramData\NVIDIA Corporation\CUDA Samples\v9.0\0_Simple\simplePrintf\simplePrintf.cu" -I"c:\ProgramData\NVIDIA Corporation\CUDA Samples\v9.0\common\inc" --cuda-gpu-arch=sm_50 --cuda-path="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0" -L"c:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\lib\x64" -lcudart.lib -v [Output] In file included from C:\GIT\LLVM\trunk-for-submits\llvm-64-release-vs2017-15.9.9\dist\lib\clang\9.0.0\include\__clang_cuda_runtime_wrapper.h:327: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0/include\crt/math_functions.hpp:390:11: error: no matching function for call to '__isinfl' return (__isinfl(a) != 0); ^~~~ C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0/include\crt/math_functions.hpp:2662:14: note: candidate function not viable: call to __host__ function from __device__ function __func__(int __isinfl(long double a)) ^ In file included from :1: In file included from C:\GIT\LLVM\trunk-for-submits\llvm-64-release-vs2017-15.9.9\dist\lib\clang\9.0.0\include\__clang_cuda_runtime_wrapper.h:327: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0/include\crt/math_functions.hpp:438:11: error: no matching function for call to '__isnanl' return (__isnanl(a) != 0); ^~~~ C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0/include\crt/math_functions.hpp:2672:14: note: candidate function not viable: call to __host__ function from __device__ function __func__(int __isnanl(long double a)) ^ In file included from :1: In file included from C:\GIT\LLVM\trunk-for-submits\llvm-64-release-vs2017-15.9.9\dist\lib\clang\9.0.0\include\__clang_cuda_runtime_wrapper.h:327: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0/include\crt/math_functions.hpp:486:11: error: no matching function for call to '__finitel' return (__finitel(a) != 0); ^ C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0/include\crt/math_functions.hpp:2652:14: note: candidate function not viable: call to __host__ function from __device__ function __func__(int __finitel(long double a)) ^ 3 errors generated when compiling for sm_50. [Solution] Add missing long double device functions' declarations. Provide only declarations to prevent any use of long double on the device side, because CUDA does not support long double on the device side. [Testing] {Windows 10, Ubuntu 16.04.5}/{Visual C++ 2017 15.9.9, gcc+ 5.4.0}/CUDA {8.0, 9.0, 9.1, 9.2, 10.0, 10.1} Reviewed by: Artem Belevich Differential Revision: http://reviews.llvm.org/D60220 Modified: cfe/trunk/lib/Headers/__clang_cuda_cmath.h cfe/trunk/lib/Headers/__clang_cuda_device_functions.h cfe/trunk/lib/Headers/__clang_cuda_math_forward_declares.h Modified: cfe/trunk/lib/Headers/__clang_cuda_cmath.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/__clang_cuda_cmath.h?rev=357779&r1=357778&r2=357779&view=diff == --- cfe/trunk/lib/Headers/__clang_cuda_cmath.h (original) +++ cfe/trunk/lib/Headers/__clang_cuda_cmath.h Fri Apr 5 09:51:10 2019 @@ -78,13 +78,16 @@ __DEVICE__ float frexp(float __arg, int #ifndef _MSC_VER __DEVICE__ bool isinf(float __x) { return ::__isinff(__x); } __DEVICE__ bool isinf(double __x) { return ::__isinf(__x); } +__DEVICE__ bool isinf(long double __x) { return ::__isinfl(__x); } __DEVICE__ bool isfinite(float __x) { return ::__finitef(__x); } // For inscrutable reasons, __finite(), the double-precision version of // __finitef, does not exist when compiling for MacOS. __isfinited is available // everywhere and is just as good. __DEVICE__ bool isfinite(double __x) { return ::__isfinited(__x); } +__DEVICE__ bool isfinite(long double __x) { return ::__finitel(__x); } __DEVICE__ bool isnan(float __x) { return ::__isnanf(__x); } __DEVICE__ bool isnan(double __x) { return ::__isnan(__x); } +__DEVICE__ bool isnan(long double __x) { return ::__isnanl(__x); } #endif __DEVICE__ bool isgreater(float __x, float __y) { Modified: cfe/trunk/lib/Headers/__clang_cuda_device_functions.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/__clang_cuda_device_functions.h?rev=357779&r1=357778&r2=357779&view=diff
r358654 - [CUDA][Windows] Restrict long double device functions declarations to Windows
Author: emankov Date: Thu Apr 18 03:08:55 2019 New Revision: 358654 URL: http://llvm.org/viewvc/llvm-project?rev=358654&view=rev Log: [CUDA][Windows] Restrict long double device functions declarations to Windows As agreed in D60220, make long double declarations unobservable on non-windows platforms. [Testing] {Windows 10, Ubuntu 16.04.5}/{Visual C++ 2017 15.9.11 & 2019 16.0.1, gcc+ 5.4.0}/CUDA {8.0, 9.0, 9.1, 9.2, 10.0, 10.1} Reviewed by: Artem Belevich Differential Revision: https://reviews.llvm.org/D60818 Modified: cfe/trunk/lib/Headers/__clang_cuda_cmath.h cfe/trunk/lib/Headers/__clang_cuda_device_functions.h cfe/trunk/lib/Headers/__clang_cuda_math_forward_declares.h Modified: cfe/trunk/lib/Headers/__clang_cuda_cmath.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/__clang_cuda_cmath.h?rev=358654&r1=358653&r2=358654&view=diff == --- cfe/trunk/lib/Headers/__clang_cuda_cmath.h (original) +++ cfe/trunk/lib/Headers/__clang_cuda_cmath.h Thu Apr 18 03:08:55 2019 @@ -64,16 +64,13 @@ __DEVICE__ float frexp(float __arg, int #ifndef _MSC_VER __DEVICE__ bool isinf(float __x) { return ::__isinff(__x); } __DEVICE__ bool isinf(double __x) { return ::__isinf(__x); } -__DEVICE__ bool isinf(long double __x) { return ::__isinfl(__x); } __DEVICE__ bool isfinite(float __x) { return ::__finitef(__x); } // For inscrutable reasons, __finite(), the double-precision version of // __finitef, does not exist when compiling for MacOS. __isfinited is available // everywhere and is just as good. __DEVICE__ bool isfinite(double __x) { return ::__isfinited(__x); } -__DEVICE__ bool isfinite(long double __x) { return ::__finitel(__x); } __DEVICE__ bool isnan(float __x) { return ::__isnanf(__x); } __DEVICE__ bool isnan(double __x) { return ::__isnan(__x); } -__DEVICE__ bool isnan(long double __x) { return ::__isnanl(__x); } #endif __DEVICE__ bool isgreater(float __x, float __y) { Modified: cfe/trunk/lib/Headers/__clang_cuda_device_functions.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/__clang_cuda_device_functions.h?rev=358654&r1=358653&r2=358654&view=diff == --- cfe/trunk/lib/Headers/__clang_cuda_device_functions.h (original) +++ cfe/trunk/lib/Headers/__clang_cuda_device_functions.h Thu Apr 18 03:08:55 2019 @@ -223,7 +223,9 @@ __DEVICE__ int __ffs(int __a) { return _ __DEVICE__ int __ffsll(long long __a) { return __nv_ffsll(__a); } __DEVICE__ int __finite(double __a) { return __nv_isfinited(__a); } __DEVICE__ int __finitef(float __a) { return __nv_finitef(__a); } +#ifdef _MSC_VER __DEVICE__ int __finitel(long double __a); +#endif __DEVICE__ int __float2int_rd(float __a) { return __nv_float2int_rd(__a); } __DEVICE__ int __float2int_rn(float __a) { return __nv_float2int_rn(__a); } __DEVICE__ int __float2int_ru(float __a) { return __nv_float2int_ru(__a); } @@ -432,10 +434,14 @@ __DEVICE__ float __int_as_float(int __a) __DEVICE__ int __isfinited(double __a) { return __nv_isfinited(__a); } __DEVICE__ int __isinf(double __a) { return __nv_isinfd(__a); } __DEVICE__ int __isinff(float __a) { return __nv_isinff(__a); } +#ifdef _MSC_VER __DEVICE__ int __isinfl(long double __a); +#endif __DEVICE__ int __isnan(double __a) { return __nv_isnand(__a); } __DEVICE__ int __isnanf(float __a) { return __nv_isnanf(__a); } +#ifdef _MSC_VER __DEVICE__ int __isnanl(long double __a); +#endif __DEVICE__ double __ll2double_rd(long long __a) { return __nv_ll2double_rd(__a); } Modified: cfe/trunk/lib/Headers/__clang_cuda_math_forward_declares.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/__clang_cuda_math_forward_declares.h?rev=358654&r1=358653&r2=358654&view=diff == --- cfe/trunk/lib/Headers/__clang_cuda_math_forward_declares.h (original) +++ cfe/trunk/lib/Headers/__clang_cuda_math_forward_declares.h Thu Apr 18 03:08:55 2019 @@ -84,14 +84,18 @@ __DEVICE__ double hypot(double, double); __DEVICE__ float hypot(float, float); __DEVICE__ int ilogb(double); __DEVICE__ int ilogb(float); +#ifdef _MSC_VER __DEVICE__ bool isfinite(long double); +#endif __DEVICE__ bool isfinite(double); __DEVICE__ bool isfinite(float); __DEVICE__ bool isgreater(double, double); __DEVICE__ bool isgreaterequal(double, double); __DEVICE__ bool isgreaterequal(float, float); __DEVICE__ bool isgreater(float, float); +#ifdef _MSC_VER __DEVICE__ bool isinf(long double); +#endif __DEVICE__ bool isinf(double); __DEVICE__ bool isinf(float); __DEVICE__ bool isless(double, double); @@ -100,7 +104,9 @@ __DEVICE__ bool islessequal(float, float __DEVICE__ bool isless(float, float); __DEVICE__ bool islessgreater(double, double); __DEVICE__ bool islessgreater(float, float); +#ifdef _MSC_VER __DEVICE__ bool isnan(long double); +#endif __DEVICE__ bool i
[clang] [CUDA][Win32] Add `fma(long double,..)` to math forward declares. (PR #73756)
@@ -70,6 +70,9 @@ __DEVICE__ double floor(double); __DEVICE__ float floor(float); __DEVICE__ double fma(double, double, double); __DEVICE__ float fma(float, float, float); +#ifdef _MSC_VER +__DEVICE__ long double fma(long double, long double, long double); emankov wrote: That's right, CUDA has provided `long double fma` since 10.2 but for `HOST` only: ```cpp inline _LIBCUDACXX_INLINE_VISIBILITY long double fma(long double __lcpp_x, long double __lcpp_y, long double __lcpp_z) _NOEXCEPT {return ::fmal(__lcpp_x, __lcpp_y, __lcpp_z);} ``` If a declaration of `device long double fma` is needed in order to parse it only and with disallowing its usage on GPU, then it is better to add it to `clang/lib/Headers/cuda_wrappers/cmath` under `_LIBCPP_STD_VER` and `_LIBCPP_HIDE_FROM_ABI`; and it would need a corresponding `GPU` test, of course. https://github.com/llvm/llvm-project/pull/73756 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [CUDA][Win32] Add `fma(long double,..)` to math forward declares. (PR #73756)
@@ -70,6 +70,9 @@ __DEVICE__ double floor(double); __DEVICE__ float floor(float); __DEVICE__ double fma(double, double, double); __DEVICE__ float fma(float, float, float); +#ifdef _MSC_VER +__DEVICE__ long double fma(long double, long double, long double); emankov wrote: Yes, we have. But how do we prevent them from running on GPU? https://github.com/llvm/llvm-project/pull/73756 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [CUDA][Win32] Add `fma(long double,..)` to math forward declares. (PR #73756)
@@ -70,6 +70,9 @@ __DEVICE__ double floor(double); __DEVICE__ float floor(float); __DEVICE__ double fma(double, double, double); __DEVICE__ float fma(float, float, float); +#ifdef _MSC_VER +__DEVICE__ long double fma(long double, long double, long double); emankov wrote: That is it, it is only a compile-time story, and the situation when the successfully compiled code "fails somewhere in ptxas" on runtime would never happen till CUDA implementation of `long double fma` appears, or am I missing something? https://github.com/llvm/llvm-project/pull/73756 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [CUDA][Win32] Add `fma(long double,..)` to math forward declares. (PR #73756)
emankov wrote: Hello, @fodinabor and @blinkfrog > the #ifdef _MSC_VER check may not be effective because _MSC_VER is specific > to the MSVC compiler and is not defined when using Clang, even on Windows Does it mean that this fix doesn't solve https://github.com/AdaptiveCpp/AdaptiveCpp/issues/1256? Or, is [blinkfrog](https://github.com/blinkfrog) saying above about yet other cases? https://github.com/llvm/llvm-project/pull/73756 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] c231471 - [clang][CUDA][Windows] Fix compilation error on Windows with `uint32_t __nvvm_get_smem_pointer`
Author: Evgeny Mankov Date: 2022-04-21T00:41:20+03:00 New Revision: c23147106f7efc4b5e29c47a08951116b4d994ac URL: https://github.com/llvm/llvm-project/commit/c23147106f7efc4b5e29c47a08951116b4d994ac DIFF: https://github.com/llvm/llvm-project/commit/c23147106f7efc4b5e29c47a08951116b4d994ac.diff LOG: [clang][CUDA][Windows] Fix compilation error on Windows with `uint32_t __nvvm_get_smem_pointer` The change fixes https://github.com/llvm/llvm-project/issues/54609 (the second reported issue) by eliminating a compilation error occurring only on Windows while trying to compile any CUDA source file by clang (-x cuda). [Repro] clang -x cuda [Error] __clang_cuda_runtime_wrapper.h:473: __clang_cuda_intrinsics.h(517,19): error GC871EEFB: unknown type name 'uint32_t'; did you mean 'cuuint32_t'? __device__ inline uint32_t __nvvm_get_smem_pointer(void *__ptr) { ^ C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.6/include\cuda.h:57:26: note: 'cuuint32_t' declared here typedef unsigned __int32 cuuint32_t; Reviewed By: tra Differential Revision: https://reviews.llvm.org/D122897 Added: Modified: clang/lib/Headers/__clang_cuda_intrinsics.h Removed: diff --git a/clang/lib/Headers/__clang_cuda_intrinsics.h b/clang/lib/Headers/__clang_cuda_intrinsics.h index eee2930ece85a..cfd5eb869e340 100644 --- a/clang/lib/Headers/__clang_cuda_intrinsics.h +++ b/clang/lib/Headers/__clang_cuda_intrinsics.h @@ -509,7 +509,7 @@ __device__ inline void *__nv_cvta_constant_to_generic_impl(size_t __ptr) { __device__ inline void *__nv_cvta_local_to_generic_impl(size_t __ptr) { return (void *)(void __attribute__((address_space(5))) *)__ptr; } -__device__ inline uint32_t __nvvm_get_smem_pointer(void *__ptr) { +__device__ inline cuuint32_t __nvvm_get_smem_pointer(void *__ptr) { return __nv_cvta_generic_to_shared_impl(__ptr); } } // extern "C" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r370123 - [preprocessor] Add an opportunity to retain excluded conditional blocks
Author: emankov Date: Tue Aug 27 15:15:32 2019 New Revision: 370123 URL: http://llvm.org/viewvc/llvm-project?rev=370123&view=rev Log: [preprocessor] Add an opportunity to retain excluded conditional blocks It is handy for clang tooling, for instance, in source to source transformation. Reviewers: vpykhtin (Valery Pykhtin), erichkeane (Erich Keane) Subscribers: rsmith (Richard Smith), akyrtzi (Argyrios Kyrtzidis) Tags: #clang Differential Revision: https://reviews.llvm.org/D66597 Added: cfe/trunk/test/Index/retain-excluded-conditional-blocks.m Modified: cfe/trunk/include/clang-c/Index.h cfe/trunk/include/clang/Frontend/ASTUnit.h cfe/trunk/include/clang/Lex/PreprocessorOptions.h cfe/trunk/lib/Frontend/ASTUnit.cpp cfe/trunk/lib/Lex/PPDirectives.cpp cfe/trunk/tools/c-index-test/c-index-test.c cfe/trunk/tools/libclang/CIndex.cpp Modified: cfe/trunk/include/clang-c/Index.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=370123&r1=370122&r2=370123&view=diff == --- cfe/trunk/include/clang-c/Index.h (original) +++ cfe/trunk/include/clang-c/Index.h Tue Aug 27 15:15:32 2019 @@ -1356,7 +1356,12 @@ enum CXTranslationUnit_Flags { * the case where these warnings are not of interest, as for an IDE for * example, which typically shows only the diagnostics in the main file. */ - CXTranslationUnit_IgnoreNonErrorsFromIncludedFiles = 0x4000 + CXTranslationUnit_IgnoreNonErrorsFromIncludedFiles = 0x4000, + + /** + * Tells the preprocessor not to skip excluded conditional blocks. + */ + CXTranslationUnit_RetainExcludedConditionalBlocks = 0x8000, }; /** Modified: cfe/trunk/include/clang/Frontend/ASTUnit.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/ASTUnit.h?rev=370123&r1=370122&r2=370123&view=diff == --- cfe/trunk/include/clang/Frontend/ASTUnit.h (original) +++ cfe/trunk/include/clang/Frontend/ASTUnit.h Tue Aug 27 15:15:32 2019 @@ -832,6 +832,7 @@ public: SkipFunctionBodiesScope::None, bool SingleFileParse = false, bool UserFilesAreVolatile = false, bool ForSerialization = false, + bool RetainExcludedConditionalBlocks = false, llvm::Optional ModuleFormat = llvm::None, std::unique_ptr *ErrAST = nullptr, IntrusiveRefCntPtr VFS = nullptr); Modified: cfe/trunk/include/clang/Lex/PreprocessorOptions.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/PreprocessorOptions.h?rev=370123&r1=370122&r2=370123&view=diff == --- cfe/trunk/include/clang/Lex/PreprocessorOptions.h (original) +++ cfe/trunk/include/clang/Lex/PreprocessorOptions.h Tue Aug 27 15:15:32 2019 @@ -142,6 +142,9 @@ public: /// compiler invocation and its buffers will be reused. bool RetainRemappedFileBuffers = false; + /// When enabled, excluded conditional blocks retain in the main file. + bool RetainExcludedConditionalBlocks = false; + /// The Objective-C++ ARC standard library that we should support, /// by providing appropriate definitions to retrofit the standard library /// with support for lifetime-qualified pointers. @@ -201,6 +204,7 @@ public: RetainRemappedFileBuffers = true; PrecompiledPreambleBytes.first = 0; PrecompiledPreambleBytes.second = false; +RetainExcludedConditionalBlocks = false; } }; Modified: cfe/trunk/lib/Frontend/ASTUnit.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTUnit.cpp?rev=370123&r1=370122&r2=370123&view=diff == --- cfe/trunk/lib/Frontend/ASTUnit.cpp (original) +++ cfe/trunk/lib/Frontend/ASTUnit.cpp Tue Aug 27 15:15:32 2019 @@ -1735,6 +1735,7 @@ ASTUnit *ASTUnit::LoadFromCommandLine( bool CacheCodeCompletionResults, bool IncludeBriefCommentsInCodeCompletion, bool AllowPCHWithCompilerErrors, SkipFunctionBodiesScope SkipFunctionBodies, bool SingleFileParse, bool UserFilesAreVolatile, bool ForSerialization, +bool RetainExcludedConditionalBlocks, llvm::Optional ModuleFormat, std::unique_ptr *ErrAST, IntrusiveRefCntPtr VFS) { assert(Diags.get() && "no DiagnosticsEngine was provided"); @@ -1762,6 +1763,7 @@ ASTUnit *ASTUnit::LoadFromCommandLine( PPOpts.RemappedFilesKeepOriginalName = RemappedFilesKeepOriginalName; PPOpts.AllowPCHWithCompilerErrors = AllowPCHWithCompilerErrors; PPOpts.SingleFileParseMode = SingleFileParse; + PPOpts.RetainExcludedConditionalBlocks = RetainExcludedConditionalBlocks; // Override the resources path. CI->getHeaderSearchOpts().ResourceDir = ResourceFilesPath; Modified: cfe/trunk/lib/Lex/PPDirectives.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPDirectives.cpp?rev=370123&r1=370122&r2=3701