[PATCH] D89478: AMDGPU: Make sure both cc1 and cc1as process -m[no-]code-object-v3
Konstantin Zhuravlyov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 15 08:56:41 PDT 2020
kzhuravl created this revision.
kzhuravl added reviewers: msearles, ronlieb, scott.linder, t-tye.
Herald added subscribers: kerbowa, tpr, dstuttard, yaxunl, nhaehnle, jvesely.
kzhuravl requested review of this revision.
Herald added a subscriber: wdng.
https://reviews.llvm.org/D89478
Files:
clang/lib/Driver/ToolChains/AMDGPU.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/amdgpu-features-as.s
Index: clang/test/Driver/amdgpu-features-as.s
===================================================================
--- /dev/null
+++ clang/test/Driver/amdgpu-features-as.s
@@ -0,0 +1,7 @@
+// RUN: %clang -### -target amdgcn-amd-amdhsa -mcpu=gfx900 -mcode-object-v3 %s 2>&1 | FileCheck --check-prefix=CODE-OBJECT-V3 %s
+// CODE-OBJECT-V3: warning: argument '-mcode-object-v3' is deprecated, use '-mllvm --amdhsa-code-object-version=3' instead [-Wdeprecated]
+// CODE-OBJECT-V3: "-mllvm" "--amdhsa-code-object-version=3"
+
+// RUN: %clang -### -target amdgcn-amd-amdhsa amdgcn -mcpu=gfx900 -mno-code-object-v3 %s 2>&1 | FileCheck --check-prefix=NO-CODE-OBJECT-V3 %s
+// NO-CODE-OBJECT-V3: warning: argument '-mno-code-object-v3' is deprecated, use '-mllvm --amdhsa-code-object-version=2' instead [-Wdeprecated]
+// NO-CODE-OBJECT-V3: "-mllvm" "--amdhsa-code-object-version=2"
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -6122,6 +6122,19 @@
}
}
+ if (Args.hasArg(options::OPT_mcode_object_v3_legacy)) {
+ D.Diag(diag::warn_drv_deprecated_arg) << "-mcode-object-v3" <<
+ "-mllvm --amdhsa-code-object-version=3";
+ CmdArgs.push_back("-mllvm");
+ CmdArgs.push_back("--amdhsa-code-object-version=3");
+ }
+ if (Args.hasArg(options::OPT_mno_code_object_v3_legacy)) {
+ D.Diag(diag::warn_drv_deprecated_arg) << "-mno-code-object-v3" <<
+ "-mllvm --amdhsa-code-object-version=2";
+ CmdArgs.push_back("-mllvm");
+ CmdArgs.push_back("--amdhsa-code-object-version=2");
+ }
+
// For all the host OpenMP offloading compile jobs we need to pass the targets
// information using -fopenmp-targets= option.
if (JA.isHostOffloading(Action::OFK_OpenMP)) {
@@ -7085,6 +7098,19 @@
CmdArgs.push_back(SplitDebugName(JA, Args, Input, Output));
}
+ if (Args.hasArg(options::OPT_mcode_object_v3_legacy)) {
+ D.Diag(diag::warn_drv_deprecated_arg) << "-mcode-object-v3" <<
+ "-mllvm --amdhsa-code-object-version=3";
+ CmdArgs.push_back("-mllvm");
+ CmdArgs.push_back("--amdhsa-code-object-version=3");
+ }
+ if (Args.hasArg(options::OPT_mno_code_object_v3_legacy)) {
+ D.Diag(diag::warn_drv_deprecated_arg) << "-mno-code-object-v3" <<
+ "-mllvm --amdhsa-code-object-version=2";
+ CmdArgs.push_back("-mllvm");
+ CmdArgs.push_back("--amdhsa-code-object-version=2");
+ }
+
assert(Input.isFilename() && "Invalid input.");
CmdArgs.push_back(Input.getFilename());
Index: clang/lib/Driver/ToolChains/AMDGPU.cpp
===================================================================
--- clang/lib/Driver/ToolChains/AMDGPU.cpp
+++ clang/lib/Driver/ToolChains/AMDGPU.cpp
@@ -525,19 +525,6 @@
CC1Args.push_back("hidden");
CC1Args.push_back("-fapply-global-visibility-to-externs");
}
-
- if (DriverArgs.hasArg(options::OPT_mcode_object_v3_legacy)) {
- getDriver().Diag(diag::warn_drv_deprecated_arg) << "-mcode-object-v3" <<
- "-mllvm --amdhsa-code-object-version=3";
- CC1Args.push_back("-mllvm");
- CC1Args.push_back("--amdhsa-code-object-version=3");
- }
- if (DriverArgs.hasArg(options::OPT_mno_code_object_v3_legacy)) {
- getDriver().Diag(diag::warn_drv_deprecated_arg) << "-mno-code-object-v3" <<
- "-mllvm --amdhsa-code-object-version=2";
- CC1Args.push_back("-mllvm");
- CC1Args.push_back("--amdhsa-code-object-version=2");
- }
}
StringRef
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89478.298398.patch
Type: text/x-patch
Size: 3508 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201015/dacacdc0/attachment.bin>
More information about the llvm-commits
mailing list