diff options
| author | Justin Lebar <jlebar@google.com> | 2016-09-09 20:35:43 +0000 | 
|---|---|---|
| committer | Justin Lebar <jlebar@google.com> | 2016-09-09 20:35:43 +0000 | 
| commit | 5057f17716f0622e3237af141627fb0eeba76fa1 (patch) | |
| tree | 5f22934af09bb382fc4d40371ededc3af6afa051 /clang/lib | |
| parent | 92e33a3ebcb6e1912f7d4c5be17b5eb7b3c19b1a (diff) | |
| download | bcm5719-llvm-5057f17716f0622e3237af141627fb0eeba76fa1.tar.gz bcm5719-llvm-5057f17716f0622e3237af141627fb0eeba76fa1.zip  | |
[CUDA] Make __GCC_ATOMIC_XXX_LOCK_FREE macros the same on host/device.
Summary:
This fixes a bug where we were unable to compile the following CUDA
file with libstdc++ (didn't try libc++):
  #include <future>
  void foo() { std::shared_future<int> x; }
The problem is that <future> only defines std::shared_future if
__GCC_ATOMIC_INT_LOCK_FREE > 1.  When we compiled this file for device,
the macro was set to 1, and then the class didn't exist at all.
Reviewers: tra
Subscribers: cfe-commits, jhen
Differential Revision: https://reviews.llvm.org/D24407
llvm-svn: 281089
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Basic/Targets.cpp | 6 | 
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index 535b6810356..15190594fc5 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -1768,6 +1768,12 @@ public:      UseExplicitBitFieldAlignment = HostTarget->useExplicitBitFieldAlignment();      ZeroLengthBitfieldBoundary = HostTarget->getZeroLengthBitfieldBoundary(); +    // This is a bit of a lie, but it controls __GCC_ATOMIC_XXX_LOCK_FREE, and +    // we need those macros to be identical on host and device, because (among +    // other things) they affect which standard library classes are defined, and +    // we need all classes to be defined on both the host and device. +    MaxAtomicInlineWidth = HostTarget->getMaxAtomicInlineWidth(); +      // Properties intentionally not copied from host:      // - LargeArrayMinWidth, LargeArrayAlign: Not visible across the      //   host/device boundary.  | 

