when a BindArchAction is used.
This is not a functional change.
Original Diff: D29654
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310433
91177308-0d34-0410-b5e6-
96231b3b80d8
C.getSingleOffloadToolChain<Action::OFK_Host>();
assert(HostTC && "Host toolchain should be always defined.");
auto &CudaTC =
- ToolChains[TT.str() + "/" + HostTC->getTriple().str()];
+ ToolChains[TT.str() + "/" + HostTC->getTriple().normalize()];
if (!CudaTC)
CudaTC = llvm::make_unique<toolchains::CudaToolChain>(
*this, TT, *HostTC, C.getInputArgs(), Action::OFK_OpenMP);
// Get the unique string identifier for this dependence and cache the
// result.
CachedResults[{A, GetTriplePlusArchString(
- UI.DependentToolChain, UI.DependentBoundArch,
+ UI.DependentToolChain, BoundArch,
UI.DependentOffloadKind)}] = CurI;
}
if (DeviceOffloadKind == Action::OFK_OpenMP) {
DerivedArgList *DAL = new DerivedArgList(Args.getBaseArgs());
const OptTable &Opts = getDriver().getOpts();
+ bool NewArgAdded = false;
// Handle -Xopenmp-target flags
for (Arg *A : Args) {
XOpenMPTargetArg->setBaseArg(A);
A = XOpenMPTargetArg.release();
DAL->append(A);
+ NewArgAdded = true;
}
- return DAL;
+ return NewArgAdded ? DAL : nullptr;
}
return nullptr;
/// ###########################################################################
+/// Check cubin file generation and usage by nvlink when toolchain has BindArchAction
+// RUN: %clang -### -no-canonical-prefixes -target x86_64-apple-darwin17.0.0 -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -save-temps -no-canonical-prefixes %s 2>&1 \
+// RUN: | FileCheck -check-prefix=CHK-CUBIN-DARWIN %s
+
+// CHK-CUBIN-DARWIN: clang{{.*}}" "-o" "{{.*}}-openmp-nvptx64-nvidia-cuda.s"
+// CHK-CUBIN-DARWIN-NEXT: ptxas{{.*}}" "--output-file" "{{.*}}-openmp-nvptx64-nvidia-cuda.cubin" "{{.*}}-openmp-nvptx64-nvidia-cuda.s"
+// CHK-CUBIN-DARWIN-NEXT: nvlink" "-o" "{{.*}}-openmp-nvptx64-nvidia-cuda" {{.*}} "openmp-offload-openmp-nvptx64-nvidia-cuda.cubin"
+
+/// ###########################################################################
+
/// Check cubin file generation and usage by nvlink
// RUN: touch %t1.o
// RUN: touch %t2.o
// RUN: | FileCheck -check-prefix=CHK-TWOCUBIN %s
// CHK-TWOCUBIN: nvlink"{{.*}}"openmp-offload-{{.*}}.cubin" "openmp-offload-{{.*}}.cubin"
+
+/// ###########################################################################
+
+/// Check cubin file generation and usage by nvlink when toolchain has BindArchAction
+// RUN: touch %t1.o
+// RUN: touch %t2.o
+// RUN: %clang -### -no-canonical-prefixes -target x86_64-apple-darwin17.0.0 -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda %t1.o %t2.o 2>&1 \
+// RUN: | FileCheck -check-prefix=CHK-TWOCUBIN-DARWIN %s
+
+// CHK-TWOCUBIN-DARWIN: nvlink"{{.*}}"openmp-offload-{{.*}}.cubin" "openmp-offload-{{.*}}.cubin"