Skip to content

Commit 0ca6c89

Browse files
committed
Revert "fix upstream/downstream issues"
This reverts commit 00dce9f.
1 parent af05b3e commit 0ca6c89

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

clang/lib/Driver/Driver.cpp

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4723,6 +4723,12 @@ Driver::getOffloadArchs(Compilation &C, const llvm::opt::DerivedArgList &Args,
47234723
}
47244724

47254725
llvm::DenseSet<StringRef> Archs;
4726+
4727+
if (!TC->getTargetID().empty()) {
4728+
Archs.insert(TC->getTargetID());
4729+
return llvm::SmallVector<StringRef>();
4730+
}
4731+
47264732
for (auto *Arg : C.getArgsForToolChain(&TC, /*BoundArch=*/"", Kind)) {
47274733
// Add or remove the seen architectures in order of appearance. If an
47284734
// invalid architecture is given we simply exit.
@@ -4731,36 +4737,40 @@ Driver::getOffloadArchs(Compilation &C, const llvm::opt::DerivedArgList &Args,
47314737
if (Arch == "native" || Arch.empty()) {
47324738
auto GPUsOrErr = TC.getSystemGPUArchs(Args);
47334739
if (!GPUsOrErr) {
4734-
TC.getDriver().Diag(diag::err_drv_undetermined_gpu_arch)
4735-
<< llvm::Triple::getArchTypeName(TC.getArch())
4736-
<< llvm::toString(GPUsOrErr.takeError()) << "--offload-arch";
4740+
if (!SpecificToolchain)
4741+
llvm::consumeError(GPUsOrErr.takeError());
4742+
else
4743+
TC.getDriver().Diag(diag::err_drv_undetermined_gpu_arch)
4744+
<< llvm::Triple::getArchTypeName(TC.getArch())
4745+
<< llvm::toString(GPUsOrErr.takeError()) << "--offload-arch";
47374746
continue;
47384747
}
47394748

47404749
for (auto ArchStr : *GPUsOrErr) {
4741-
StringRef CanonicalStr = getCanonicalArchString(
4742-
C, Args, Args.MakeArgString(ArchStr), TC.getTriple());
4750+
StringRef CanonicalStr =
4751+
getCanonicalArchString(C, Args, Args.MakeArgString(ArchStr),
4752+
TC.getTriple());
47434753
if (!CanonicalStr.empty())
47444754
Archs.insert(CanonicalStr);
47454755
else
47464756
return llvm::SmallVector<StringRef>();
47474757
}
47484758
} else {
4749-
StringRef CanonicalStr =
4750-
getCanonicalArchString(C, Args, Arch, TC.getTriple());
4759+
StringRef CanonicalStr = getCanonicalArchString(
4760+
C, Args, Arch, TC.getTriple());
47514761
if (!CanonicalStr.empty())
47524762
Archs.insert(CanonicalStr);
47534763
else
47544764
return llvm::SmallVector<StringRef>();
47554765
}
47564766
}
47574767
} else if (Arg->getOption().matches(options::OPT_no_offload_arch_EQ)) {
4758-
for (StringRef Arch : Arg->getValues()) {
4768+
for (StringRef Arch : Arg->getValues()) {
47594769
if (Arch == "all") {
47604770
Archs.clear();
47614771
} else {
4762-
StringRef ArchStr =
4763-
getCanonicalArchString(C, Args, Arch, TC.getTriple());
4772+
StringRef ArchStr = getCanonicalArchString(
4773+
C, Args, Arch, TC.getTriple());
47644774
Archs.erase(ArchStr);
47654775
}
47664776
}

clang/lib/Driver/ToolChains/OpaqueOffloadLinker.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,8 @@ static void addSubArchsWithTargetID(Compilation &C, const ArgList &Args,
3535
const llvm::Triple &Triple,
3636
SmallVectorImpl<std::string> &subarchs) {
3737
// process OPT_offload_arch_EQ subarch specification
38-
ToolChain *TC;
3938
for (auto itr : C.getDriver().getOffloadArchs(
40-
C, C.getArgs(), Action::OFK_OpenMP, *TC))
39+
C, C.getArgs(), Action::OFK_OpenMP, nullptr, true))
4140
subarchs.push_back(itr.str());
4241

4342
// process OPT_Xopenmp_target_EQ subarch specification with march

0 commit comments

Comments
 (0)