[PATCH] D13144: [CUDA] propagate to CUDA sub-compilations target triple of opposite side.

Eric Christopher via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 28 15:11:07 PDT 2015

echristo added a comment.

Some inline comments for discussion.



Comment at: lib/Driver/Driver.cpp:503
@@ -502,3 +502,3 @@
   if (TC.getTriple().isOSBinFormatMachO())
-    BuildUniversalActions(C->getDefaultToolChain(), C->getArgs(), Inputs,
+    BuildUniversalActions(*C, C->getDefaultToolChain(), C->getArgs(), Inputs,
Can pass one or the other here? I don't think you need both a reference to C and one of its members?

Comment at: lib/Driver/Driver.cpp:1285-1291
@@ -1284,6 +1284,9 @@
+                 std::unique_ptr<Action> HostAction, ActionList &Actions) {
   // Figure out which NVPTX triple to use for device-side compilation based on
   // whether host is 64-bit.
   const char *DeviceTriple = TC.getTriple().isArch64Bit()
                                  ? "nvptx64-nvidia-cuda"
                                  : "nvptx-nvidia-cuda";
+  C.setCudaDeviceToolChain(
+      &D.getToolChain(C.getArgs(), llvm::Triple(DeviceTriple)));
   Arg *PartialCompilationArg = Args.getLastArg(options::OPT_cuda_host_only,
Can't you now do all of this in BuildCompilation?


More information about the cfe-commits mailing list