[PATCH] D21419: [CUDA] Don't pass top-level -march down to device cc1 or ptxas.

Justin Lebar via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 15 16:38:45 PDT 2016


jlebar updated this revision to Diff 60931.
jlebar added a comment.

Remove redundant test.


http://reviews.llvm.org/D21419

Files:
  lib/Driver/ToolChains.cpp
  test/Driver/cuda-march.cu

Index: test/Driver/cuda-march.cu
===================================================================
--- /dev/null
+++ test/Driver/cuda-march.cu
@@ -0,0 +1,31 @@
+// Checks that cuda compilation does the right thing when passed -march.
+// (Specifically, we want to pass it to host compilation, but not to device
+// compilation or ptxas!)
+//
+// REQUIRES: clang-driver
+// REQUIRES: x86-registered-target
+// REQUIRES: nvptx-registered-target
+
+// RUN: %clang -### -target x86_64-linux-gnu -c -march=haswell %s 2>&1 | \
+// RUN: FileCheck -check-prefix HASWELL -check-prefix SM20 %s
+
+// RUN: %clang -### -target x86_64-linux-gnu -c -march=haswell --cuda-gpu-arch=sm_20 %s 2>&1 | \
+// RUN: FileCheck -check-prefix HASWELL -check-prefix SM20 %s
+
+// SM20:clang
+// SM20: "-cc1"
+// SM20-SAME: "-triple" "nvptx
+// SM20-SAME: "-target-cpu" "sm_20"
+// SM20: ptxas
+// SM20-SAME: "--gpu-name" "sm_20"
+
+// SM30:clang
+// SM30: "-cc1"
+// SM30-SAME: "-triple" "nvptx
+// SM30-SAME: "-target-cpu" "sm_30"
+// SM30: ptxas
+// SM30-SAME: "--gpu-name" "sm_30"
+
+// HASWELL:clang
+// HASWELL-SAME: "-cc1"
+// HASWELL-SAME: "-target-cpu" "haswell"
Index: lib/Driver/ToolChains.cpp
===================================================================
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -4676,8 +4676,10 @@
     DAL->append(A);
   }
 
-  if (BoundArch)
+  if (BoundArch) {
+    DAL->eraseArg(options::OPT_march_EQ);
     DAL->AddJoinedArg(nullptr, Opts.getOption(options::OPT_march_EQ), BoundArch);
+  }
   return DAL;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21419.60931.patch
Type: text/x-patch
Size: 1547 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160615/ad7a466f/attachment.bin>


More information about the cfe-commits mailing list