From 90094ab8850ec435574fbd393d886a54a6dd2531 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sun, 5 Feb 2023 10:29:58 -0800 Subject: [PATCH] [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 --- clang/include/clang/Driver/Options.td | 2 ++ clang/test/Driver/hip-options.hip | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 5a0e904..03e6e7c 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>; +def : Joined<["-"], "mllvm=">, Flags<[CoreOption,FlangOption]>, Alias, + HelpText<"Alias for -mllvm">, MetaVarName<"">; 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 a0a4df8..97d0c13 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 \ -- 2.7.4