[clang] 90094ab - [Driver] Add -mllvm= as an alias for -mllvm
Fangrui Song via cfe-commits
cfe-commits at lists.llvm.org
Sun Feb 5 10:30:03 PST 2023
Author: Fangrui Song
Date: 2023-02-05T10:29:58-08:00
New Revision: 90094ab8850ec435574fbd393d886a54a6dd2531
URL: https://github.com/llvm/llvm-project/commit/90094ab8850ec435574fbd393d886a54a6dd2531
DIFF: https://github.com/llvm/llvm-project/commit/90094ab8850ec435574fbd393d886a54a6dd2531.diff
LOG: [Driver] Add -mllvm= as an alias for -mllvm
Similar to D131455 (-Xclang=). As well as making it convenient for some build
systems, this allows `-Xarch_device '-mllvm=--inline-threshold=100'` (and
`-Xarch_host`; so we don't need to allow space separators which are uncommon in
driver code).
Bear in mind that -mllvm options are unstable and should be avoided if possible.
Reviewed By: jhuber6, yaxunl
Differential Revision: https://reviews.llvm.org/D143325
Added:
Modified:
clang/include/clang/Driver/Options.td
clang/test/Driver/hip-options.hip
Removed:
################################################################################
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 5a0e904ffb33b..03e6e7c52d63a 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -3478,6 +3478,8 @@ def mlinker_version_EQ : Joined<["-"], "mlinker-version=">,
def mllvm : Separate<["-"], "mllvm">,Flags<[CC1Option,CC1AsOption,CoreOption,FC1Option,FlangOption]>,
HelpText<"Additional arguments to forward to LLVM's option processing">,
MarshallingInfoStringVector<FrontendOpts<"LLVMArgs">>;
+def : Joined<["-"], "mllvm=">, Flags<[CoreOption,FlangOption]>, Alias<mllvm>,
+ HelpText<"Alias for -mllvm">, MetaVarName<"<arg>">;
def mmlir : Separate<["-"], "mmlir">, Flags<[CoreOption,FC1Option,FlangOption]>,
HelpText<"Additional arguments to forward to MLIR's option processing">;
def ffuchsia_api_level_EQ : Joined<["-"], "ffuchsia-api-level=">,
diff --git a/clang/test/Driver/hip-options.hip b/clang/test/Driver/hip-options.hip
index a0a4df891b4e5..97d0c1370bc42 100644
--- a/clang/test/Driver/hip-options.hip
+++ b/clang/test/Driver/hip-options.hip
@@ -27,10 +27,10 @@
// MLLVM-NOT: "-mllvm"{{.*}}"-amdgpu-early-inline-all=true"{{.*}}"-mllvm"{{.*}}"-amdgpu-early-inline-all=true"
// RUN: %clang -### -Xarch_device -g -nogpulib --cuda-gpu-arch=gfx900 \
-// RUN: -Xarch_device -fcf-protection=branch \
+// RUN: -Xarch_device -fcf-protection=branch -Xarch_device -mllvm=--inline-threshold=100 \
// RUN: --cuda-gpu-arch=gfx906 %s 2>&1 | FileCheck -check-prefix=DEV %s
-// DEV: "-cc1"{{.*}} "-fcuda-is-device" {{.*}} "-debug-info-kind={{.*}}" {{.*}} "-fcf-protection=branch"
-// DEV: "-cc1"{{.*}} "-fcuda-is-device" {{.*}} "-debug-info-kind={{.*}}" {{.*}} "-fcf-protection=branch"
+// DEV: "-cc1"{{.*}} "-fcuda-is-device" {{.*}} "-debug-info-kind={{.*}}" {{.*}} "-fcf-protection=branch" {{.*}}"-mllvm" "--inline-threshold=100"
+// DEV: "-cc1"{{.*}} "-fcuda-is-device" {{.*}} "-debug-info-kind={{.*}}" {{.*}} "-fcf-protection=branch" {{.*}}"-mllvm" "--inline-threshold=100"
// DEV-NOT: clang{{.*}} {{.*}} "-debug-info-kind={{.*}}"
// RUN: %clang -### -Xarch_host -g -nogpulib --cuda-gpu-arch=gfx900 \
More information about the cfe-commits
mailing list