[clang] 6abaa8e - [CUDA][HIP][NFC] Do not add `-fgpu-rdc` flag twice

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 13 12:58:05 PDT 2022


Author: Joseph Huber
Date: 2022-07-13T15:57:53-04:00
New Revision: 6abaa8e2103760025cee76528f555de7cf6698e6

URL: https://github.com/llvm/llvm-project/commit/6abaa8e2103760025cee76528f555de7cf6698e6
DIFF: https://github.com/llvm/llvm-project/commit/6abaa8e2103760025cee76528f555de7cf6698e6.diff

LOG: [CUDA][HIP][NFC] Do not add `-fgpu-rdc` flag twice

Summary:
We currently add the `-fgpu-rdc` flag twice. Once unconditionally for
both the host and device phases of compilation, and a second time only
for the host. When we moved to an unconditional addition of this flag it
the old one was most likely not removed. This patch simply removes the
redundant flag and changes no functionality.

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/Clang.cpp
    clang/test/Driver/cuda-external-tools.cu

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index e187fcec75e2a..0081426e698ec 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -7011,8 +7011,6 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
   if ((IsCuda || IsHIP) && CudaDeviceInput) {
       CmdArgs.push_back("-fcuda-include-gpubinary");
       CmdArgs.push_back(CudaDeviceInput->getFilename());
-      if (Args.hasFlag(options::OPT_fgpu_rdc, options::OPT_fno_gpu_rdc, false))
-        CmdArgs.push_back("-fgpu-rdc");
   }
 
   if (IsCuda) {

diff  --git a/clang/test/Driver/cuda-external-tools.cu b/clang/test/Driver/cuda-external-tools.cu
index 198443e475bf9..1aa87cc09982c 100644
--- a/clang/test/Driver/cuda-external-tools.cu
+++ b/clang/test/Driver/cuda-external-tools.cu
@@ -160,7 +160,5 @@
 // ARCH64-SAME: "-triple" "x86_64-
 // ARCH32-SAME: "-triple" "i386-
 // CHECK-SAME: "-fcuda-include-gpubinary" "[[FATBINARY]]"
-// RDC-SAME: "-fgpu-rdc"
-// CHECK-NOT: "-fgpu-rdc"
 
 // CHK-PTXAS-VERBOSE: ptxas{{.*}}" "-v"


        


More information about the cfe-commits mailing list