[clang] a9935b5 - [openmp] Unconditionally set march commandline argument
Jon Chesterfield via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 19 11:14:56 PST 2022
Author: Joseph Huber
Date: 2022-01-19T19:14:47Z
New Revision: a9935b5db706c89182fa3a3e10f30237fb6c4ec5
URL: https://github.com/llvm/llvm-project/commit/a9935b5db706c89182fa3a3e10f30237fb6c4ec5
DIFF: https://github.com/llvm/llvm-project/commit/a9935b5db706c89182fa3a3e10f30237fb6c4ec5.diff
LOG: [openmp] Unconditionally set march commandline argument
Extracted from D117246. This reflects the march value used by the
compile back into the toolchain arguments, letting downstream processes
such as LTO rely on it being present. Subsequent patches should also be able
to remove the two other calls to checkSystemForAMDGPU.
Reviewed By: jonchesterfield
Differential Revision: https://reviews.llvm.org/D117706
Added:
Modified:
clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp b/clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp
index 198e3546d4fa2..983d40636b0cd 100644
--- a/clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp
+++ b/clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp
@@ -285,10 +285,22 @@ llvm::opt::DerivedArgList *AMDGPUOpenMPToolChain::TranslateArgs(
const OptTable &Opts = getDriver().getOpts();
- if (DeviceOffloadKind != Action::OFK_OpenMP) {
- for (Arg *A : Args) {
- DAL->append(A);
+ if (DeviceOffloadKind == Action::OFK_OpenMP) {
+ for (Arg *A : Args)
+ if (!llvm::is_contained(*DAL, A))
+ DAL->append(A);
+
+ std::string Arch = DAL->getLastArgValue(options::OPT_march_EQ).str();
+ if (Arch.empty()) {
+ checkSystemForAMDGPU(Args, *this, Arch);
+ DAL->AddJoinedArg(nullptr, Opts.getOption(options::OPT_march_EQ), Arch);
}
+
+ return DAL;
+ }
+
+ for (Arg *A : Args) {
+ DAL->append(A);
}
if (!BoundArch.empty()) {
More information about the cfe-commits
mailing list