summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/ToolChain.cpp
diff options
context:
space:
mode:
authorJonas Hahnfeld <hahnjo@hahnjo.de>2017-09-27 18:12:34 +0000
committerJonas Hahnfeld <hahnjo@hahnjo.de>2017-09-27 18:12:34 +0000
commit757e61fa4f980379f3a98c9e13e94670955138be (patch)
tree6caf70a28ca4f97f68199775ded63a2e85d303e3 /clang/lib/Driver/ToolChain.cpp
parent85f19958e9f51a3631fe94ac9c7cda725d03eb2c (diff)
downloadbcm5719-llvm-757e61fa4f980379f3a98c9e13e94670955138be.tar.gz
bcm5719-llvm-757e61fa4f980379f3a98c9e13e94670955138be.zip
[OpenMP] Fix passing of -m arguments to device toolchain
AuxTriple is not set if host and device share a toolchain. Also, removing an argument modifies the DAL which needs to be returned for future use. (Move tests back to offload-openmp.c as they are not related to GPUs.) Differential Revision: https://reviews.llvm.org/D38258 llvm-svn: 314329
Diffstat (limited to 'clang/lib/Driver/ToolChain.cpp')
-rw-r--r--clang/lib/Driver/ToolChain.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index e131ffea5cb..d6d84e4719c 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -807,16 +807,19 @@ llvm::opt::DerivedArgList *ToolChain::TranslateOpenMPTargetArgs(
if (DeviceOffloadKind == Action::OFK_OpenMP) {
DerivedArgList *DAL = new DerivedArgList(Args.getBaseArgs());
const OptTable &Opts = getDriver().getOpts();
- bool NewArgAdded = false;
+ bool Modified = false;
// Handle -Xopenmp-target flags
for (Arg *A : Args) {
// Exclude flags which may only apply to the host toolchain.
- // Do not exclude flags when the host triple (AuxTriple),
- // matches the current toolchain triple.
+ // Do not exclude flags when the host triple (AuxTriple)
+ // matches the current toolchain triple. If it is not present
+ // at all, target and host share a toolchain.
if (A->getOption().matches(options::OPT_m_Group)) {
- if (getAuxTriple() && getAuxTriple()->str() == getTriple().str())
+ if (!getAuxTriple() || getAuxTriple()->str() == getTriple().str())
DAL->append(A);
+ else
+ Modified = true;
continue;
}
@@ -857,10 +860,10 @@ llvm::opt::DerivedArgList *ToolChain::TranslateOpenMPTargetArgs(
A = XOpenMPTargetArg.release();
AllocatedArgs.push_back(A);
DAL->append(A);
- NewArgAdded = true;
+ Modified = true;
}
- if (NewArgAdded) {
+ if (Modified) {
return DAL;
} else {
delete DAL;
OpenPOWER on IntegriCloud