MaskRay created this revision. MaskRay added reviewers: aeubanks, reames, rsmith. Herald added subscribers: dang, steven_wu, hiraditya. MaskRay requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
The new PM is considered stable and many downstream groups have adopted it (some have adopted it for more than two years). Add -fnew-pass-manager to reflect the fact that it is no longer experimental. In the future, when the legacy PM eventually goes away, -fno-experimental-new-pass-manager and -fno-new-pass-manager will be removed. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D92915 Files: clang/include/clang/Driver/Options.td clang/lib/Driver/ToolChains/Clang.cpp clang/lib/Driver/ToolChains/CommonArgs.cpp clang/test/Driver/clang_f_opts.c clang/test/Driver/fnew-pass-manager.c clang/test/Driver/gold-lto-new-pass-man.c
Index: clang/test/Driver/gold-lto-new-pass-man.c =================================================================== --- clang/test/Driver/gold-lto-new-pass-man.c +++ /dev/null @@ -1,7 +0,0 @@ -// RUN: touch %t.o -// -// RUN: %clang -target ppc64le-unknown-linux -### %t.o -flto 2>&1 \ -// RUN: -Wl,-plugin-opt=foo -O3 \ -// RUN: -fexperimental-new-pass-manager \ -// RUN: | FileCheck %s -// CHECK: "-plugin-opt=new-pass-manager" Index: clang/test/Driver/fnew-pass-manager.c =================================================================== --- /dev/null +++ clang/test/Driver/fnew-pass-manager.c @@ -0,0 +1,25 @@ +// RUN: %clang -### -c -fno-new-pass-manager -fnew-pass-manager %s 2>&1 | FileCheck --check-prefixes=NOWARN,NEW %s +// RUN: %clang -### -c -fnew-pass-manager -fno-new-pass-manager %s 2>&1 | FileCheck --check-prefixes=NOWARN,LEGACY %s + +/// -f[no-]experimental-new-pass-manager are legacy aliases when the new PM was still experimental. +// RUN: %clang -### -c -fno-experimental-new-pass-manager -fexperimental-new-pass-manager %s 2>&1 | FileCheck --check-prefixes=NOWARN,NEW %s +// RUN: %clang -### -c -fexperimental-new-pass-manager -fno-experimental-new-pass-manager %s 2>&1 | FileCheck --check-prefixes=NOWARN,LEGACY %s + +// NOWARN-NOT: warning: argument unused + +// NEW: -fnew-pass-manager +// NEW-NOT: -fno-new-pass-manager + +// LEGACY: -fno-new-pass-manager +// LEGACY-NOT: -fnew-pass-manager + +/// For full/Thin LTO, -fnew-pass-manager passes -plugin-opt=new-pass-manager to the linker (which may not be LLD). +// RUN: %clang -### -target x86_64-linux -flto -fnew-pass-manager %s 2>&1 | FileCheck --check-prefixes=NEW_LINK %s +// RUN: %clang -### -target x86_64-linux -flto=thin -fexperimental-new-pass-manager %s 2>&1 | FileCheck --check-prefixes=NEW_LINK %s + +// NEW_LINK: "-plugin-opt=new-pass-manager" + +/// TODO Add the negative option and pass it to the linker. +// RUN: %clang -### -target x86_64 -flto -fno-new-pass-manager %s 2>&1 | FileCheck --check-prefixes=LEGACY_LINK %s + +// LEGACY_LINK-NOT: "-plugin-opt=new-pass-manager" Index: clang/test/Driver/clang_f_opts.c =================================================================== --- clang/test/Driver/clang_f_opts.c +++ clang/test/Driver/clang_f_opts.c @@ -469,10 +469,10 @@ // RUN: %clang -### -fno-experimental-new-pass-manager -fexperimental-new-pass-manager %s 2>&1 | FileCheck --check-prefix=CHECK-PM --check-prefix=CHECK-NEW-PM %s // RUN: %clang -### -fexperimental-new-pass-manager -fno-experimental-new-pass-manager %s 2>&1 | FileCheck --check-prefix=CHECK-PM --check-prefix=CHECK-NO-NEW-PM %s // CHECK-PM-NOT: argument unused -// CHECK-NEW-PM: -fexperimental-new-pass-manager -// CHECK-NEW-PM-NOT: -fno-experimental-new-pass-manager -// CHECK-NO-NEW-PM: -fno-experimental-new-pass-manager -// CHECK-NO-NEW-PM-NOT: -fexperimental-new-pass-manager +// CHECK-NEW-PM: -fnew-pass-manager +// CHECK-NEW-PM-NOT: -fno-new-pass-manager +// CHECK-NO-NEW-PM: -fno-new-pass-manager +// CHECK-NO-NEW-PM-NOT: -fnew-pass-manager // RUN: %clang -### -S -fstrict-return %s 2>&1 | FileCheck -check-prefix=CHECK-STRICT-RETURN %s // RUN: %clang -### -S -fno-strict-return %s 2>&1 | FileCheck -check-prefix=CHECK-NO-STRICT-RETURN %s Index: clang/lib/Driver/ToolChains/CommonArgs.cpp =================================================================== --- clang/lib/Driver/ToolChains/CommonArgs.cpp +++ clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -596,8 +596,8 @@ } // Need this flag to turn on new pass manager via Gold plugin. - if (Args.hasFlag(options::OPT_fexperimental_new_pass_manager, - options::OPT_fno_experimental_new_pass_manager, + if (Args.hasFlag(options::OPT_fnew_pass_manager, + options::OPT_fno_new_pass_manager, /* Default */ LLVM_ENABLE_NEW_PASS_MANAGER)) { CmdArgs.push_back("-plugin-opt=new-pass-manager"); } Index: clang/lib/Driver/ToolChains/Clang.cpp =================================================================== --- clang/lib/Driver/ToolChains/Clang.cpp +++ clang/lib/Driver/ToolChains/Clang.cpp @@ -5835,8 +5835,8 @@ false)) CmdArgs.push_back("-fmodules-debuginfo"); - Args.AddLastArg(CmdArgs, options::OPT_fexperimental_new_pass_manager, - options::OPT_fno_experimental_new_pass_manager); + Args.AddLastArg(CmdArgs, options::OPT_fnew_pass_manager, + options::OPT_fno_new_pass_manager); ObjCRuntime Runtime = AddObjCRuntimeArgs(Args, Inputs, CmdArgs, rewriteKind); RenderObjCOptions(TC, D, RawTriple, Args, Runtime, rewriteKind != RK_None, Index: clang/include/clang/Driver/Options.td =================================================================== --- clang/include/clang/Driver/Options.td +++ clang/include/clang/Driver/Options.td @@ -1351,9 +1351,13 @@ HelpText<"Enables the global instruction selector">; def fexperimental_isel : Flag<["-"], "fexperimental-isel">, Group<f_clang_Group>, Alias<fglobal_isel>; -defm experimental_new_pass_manager : BooleanMarshalledFFlag<"experimental-new-pass-manager", "CodeGenOpts.ExperimentalNewPassManager", - "static_cast<unsigned>(LLVM_ENABLE_NEW_PASS_MANAGER)", "Enables an experimental new pass manager in LLVM.", - "Disables an experimental new pass manager in LLVM.">, Group<f_clang_Group>, Flags<[CC1Option]>; +defm new_pass_manager : BooleanMarshalledFFlag<"new-pass-manager", "CodeGenOpts.ExperimentalNewPassManager", + "static_cast<unsigned>(LLVM_ENABLE_NEW_PASS_MANAGER)", "Use the new pass manager in LLVM", + "Use the legacy pass manager in LLVM">, Group<f_clang_Group>, Flags<[CC1Option]>; +def fexperimental_new_pass_manager : Flag<["-"], "fexperimental-new-pass-manager">, + Group<f_clang_Group>, Flags<[CC1Option]>, Alias<fnew_pass_manager>; +def fno_experimental_new_pass_manager : Flag<["-"], "fno-experimental-new-pass-manager">, + Group<f_clang_Group>, Flags<[CC1Option]>, Alias<fno_new_pass_manager>; def fexperimental_strict_floating_point : Flag<["-"], "fexperimental-strict-floating-point">, Group<f_clang_Group>, Flags<[CC1Option]>, HelpText<"Enables experimental strict floating point in LLVM.">,
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits