Author: jlebar Date: Mon Jan 25 16:36:35 2016 New Revision: 258733 URL: http://llvm.org/viewvc/llvm-project?rev=258733&view=rev Log: [CUDA] Disable ctor/dtor aliases in device code.
Summary: NVPTX doesn't support aliases, so don't generate them. Reviewers: tra Subscribers: cfe-commits, jhen, echristo Differential Revision: http://reviews.llvm.org/D16499 Added: cfe/trunk/test/Driver/cuda-constructor-alias.cu Modified: cfe/trunk/lib/Driver/Tools.cpp Modified: cfe/trunk/lib/Driver/Tools.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=258733&r1=258732&r2=258733&view=diff ============================================================================== --- cfe/trunk/lib/Driver/Tools.cpp (original) +++ cfe/trunk/lib/Driver/Tools.cpp Mon Jan 25 16:36:35 2016 @@ -3985,9 +3985,11 @@ void Clang::ConstructJob(Compilation &C, CmdArgs.push_back("Arguments"); } - // Enable -mconstructor-aliases except on darwin, where we have to - // work around a linker bug; see <rdar://problem/7651567>. - if (!getToolChain().getTriple().isOSDarwin()) + // Enable -mconstructor-aliases except on darwin, where we have to work around + // a linker bug (see <rdar://problem/7651567>), and CUDA device code, where + // aliases aren't supported. + if (!getToolChain().getTriple().isOSDarwin() && + !getToolChain().getTriple().isNVPTX()) CmdArgs.push_back("-mconstructor-aliases"); // Darwin's kernel doesn't support guard variables; just die if we Added: cfe/trunk/test/Driver/cuda-constructor-alias.cu URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cuda-constructor-alias.cu?rev=258733&view=auto ============================================================================== --- cfe/trunk/test/Driver/cuda-constructor-alias.cu (added) +++ cfe/trunk/test/Driver/cuda-constructor-alias.cu Mon Jan 25 16:36:35 2016 @@ -0,0 +1,13 @@ +// REQUIRES: clang-driver +// REQUIRES: x86-registered-target +// REQUIRES: nvptx-registered-target + +// Check that we don't pass -mconstructor-aliases to CUDA device-side +// compilation, but we do pass it to host-side compilation. + +// RUN: %clang -### %s 2>&1 | FileCheck %s +// CHECK: "-cc1" +// CHECK-NOT: "-fcuda-is-device" {{.*}}"-mconstructor-aliases" +// CHECK-NOT: "-mconstructor-aliases" {{.*}}"-fcuda-is-device" +// CHECK: "-cc1" +// CHECK-SAME: "-mconstructor-aliases" _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits