Author: Yaxun (Sam) Liu Date: 2021-03-05T08:46:58-05:00 New Revision: 258ecf5f33e7b0b43bc1c7252cd84eea596c39d2
URL: https://github.com/llvm/llvm-project/commit/258ecf5f33e7b0b43bc1c7252cd84eea596c39d2 DIFF: https://github.com/llvm/llvm-project/commit/258ecf5f33e7b0b43bc1c7252cd84eea596c39d2.diff LOG: [HIP] do not use -mconstructor-aliases for device Like nvptx and some other targets, -mconstructor-aliases does not work well with amdgpu, therefore we disable it in the same approach. Reviewed by: Artem Belevich Differential Revision: https://reviews.llvm.org/D97959 Added: Modified: clang/lib/Driver/ToolChains/Clang.cpp clang/test/Driver/hip-options.hip Removed: ################################################################################ diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index eb09d722d304..8e50e8f7d139 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -4925,9 +4925,11 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, } // 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. Similarly, aliases aren't yet supported for AIX. - if (!RawTriple.isOSDarwin() && !RawTriple.isNVPTX() && !RawTriple.isOSAIX()) + // a linker bug (see <rdar://problem/7651567>), and CUDA/AMDGPU device code, + // where aliases aren't supported. Similarly, aliases aren't yet supported + // for AIX. + if (!RawTriple.isOSDarwin() && !RawTriple.isNVPTX() && + !RawTriple.isAMDGPU() && !RawTriple.isOSAIX()) CmdArgs.push_back("-mconstructor-aliases"); // Darwin's kernel doesn't support guard variables; just die if we diff --git a/clang/test/Driver/hip-options.hip b/clang/test/Driver/hip-options.hip index d66eb14ca9bf..e1050dfab1be 100644 --- a/clang/test/Driver/hip-options.hip +++ b/clang/test/Driver/hip-options.hip @@ -40,3 +40,10 @@ // RUN: --cuda-gpu-arch=gfx906 %s 2>&1 | FileCheck -check-prefix=FIX-OVERLOAD %s // FIX-OVERLOAD: clang{{.*}} "-triple" "amdgcn-amd-amdhsa" {{.*}} "-fgpu-exclude-wrong-side-overloads" "-fgpu-defer-diag" // FIX-OVERLOAD: clang{{.*}} "-triple" "x86_64-unknown-linux-gnu" {{.*}} "-fgpu-exclude-wrong-side-overloads" "-fgpu-defer-diag" + +// Check -mconstructor-aliases is not passed to device compilation. + +// RUN: %clang -### -target x86_64-unknown-linux-gnu -nogpuinc -nogpulib \ +// RUN: --cuda-gpu-arch=gfx906 %s 2>&1 | FileCheck -check-prefix=CTA %s +// CTA: clang{{.*}} "-triple" "x86_64-unknown-linux-gnu" {{.*}} "-mconstructor-aliases" +// CTA-NOT: clang{{.*}} "-triple" "amdgcn-amd-amdhsa" {{.*}} "-mconstructor-aliases" _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits