diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -1933,7 +1933,7 @@ def fexperimental_isel : Flag<["-"], "fexperimental-isel">, Group, Alias; defm legacy_pass_manager : BoolOption<"f", "legacy-pass-manager", - CodeGenOpts<"LegacyPassManager">, Default<"!static_cast(LLVM_ENABLE_NEW_PASS_MANAGER)">, + CodeGenOpts<"LegacyPassManager">, DefaultFalse, PosFlag, NegFlag, BothFlags<[CC1Option]>>, Group; diff --git a/clang/test/CMakeLists.txt b/clang/test/CMakeLists.txt --- a/clang/test/CMakeLists.txt +++ b/clang/test/CMakeLists.txt @@ -9,7 +9,6 @@ CLANG_PLUGIN_SUPPORT CLANG_SPAWN_CC1 ENABLE_BACKTRACES - LLVM_ENABLE_NEW_PASS_MANAGER LLVM_ENABLE_ZLIB LLVM_ENABLE_PER_TARGET_RUNTIME_DIR LLVM_ENABLE_THREADS diff --git a/clang/test/lit.cfg.py b/clang/test/lit.cfg.py --- a/clang/test/lit.cfg.py +++ b/clang/test/lit.cfg.py @@ -140,10 +140,6 @@ if platform.system() not in ['FreeBSD']: config.available_features.add('crash-recovery') -# Support for new pass manager. -if config.enable_experimental_new_pass_manager: - config.available_features.add('experimental-new-pass-manager') - # ANSI escape sequences in non-dumb terminal if platform.system() not in ['Windows']: config.available_features.add('ansi-escape-sequences') diff --git a/clang/test/lit.site.cfg.py.in b/clang/test/lit.site.cfg.py.in --- a/clang/test/lit.site.cfg.py.in +++ b/clang/test/lit.site.cfg.py.in @@ -29,7 +29,6 @@ config.clang_examples = @CLANG_BUILD_EXAMPLES@ config.enable_shared = @ENABLE_SHARED@ config.enable_backtrace = @ENABLE_BACKTRACES@ -config.enable_experimental_new_pass_manager = @LLVM_ENABLE_NEW_PASS_MANAGER@ config.enable_threads = @LLVM_ENABLE_THREADS@ config.host_arch = "@HOST_ARCH@" config.python_executable = "@Python3_EXECUTABLE@" diff --git a/clang/unittests/Frontend/CompilerInvocationTest.cpp b/clang/unittests/Frontend/CompilerInvocationTest.cpp --- a/clang/unittests/Frontend/CompilerInvocationTest.cpp +++ b/clang/unittests/Frontend/CompilerInvocationTest.cpp @@ -259,49 +259,38 @@ // The flag with positive spelling can set the keypath to true. // The flag with negative spelling can set the keypath to false. -static constexpr unsigned PassManagerDefault = - !static_cast(LLVM_ENABLE_NEW_PASS_MANAGER); - -static constexpr const char *PassManagerResetByFlag = - LLVM_ENABLE_NEW_PASS_MANAGER ? "-fno-legacy-pass-manager" - : "-flegacy-pass-manager"; - -static constexpr const char *PassManagerChangedByFlag = - LLVM_ENABLE_NEW_PASS_MANAGER ? "-flegacy-pass-manager" - : "-fno-legacy-pass-manager"; - TEST_F(CommandLineTest, BoolOptionDefaultArbitraryTwoFlagsPresentNone) { const char *Args = {""}; ASSERT_TRUE(CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags)); - ASSERT_EQ(Invocation.getCodeGenOpts().LegacyPassManager, PassManagerDefault); + ASSERT_EQ(Invocation.getCodeGenOpts().LegacyPassManager, false); Invocation.generateCC1CommandLine(GeneratedArgs, *this); - ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq(PassManagerResetByFlag)))); - ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq(PassManagerChangedByFlag)))); + ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq("-fno-legacy-pass-manager")))); + ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq("-flegacy-pass-manager")))); } TEST_F(CommandLineTest, BoolOptionDefaultArbitraryTwoFlagsPresentChange) { - const char *Args[] = {PassManagerChangedByFlag}; + const char *Args[] = {"-flegacy-pass-manager"}; ASSERT_TRUE(CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags)); - ASSERT_EQ(Invocation.getCodeGenOpts().LegacyPassManager, !PassManagerDefault); + ASSERT_EQ(Invocation.getCodeGenOpts().LegacyPassManager, true); Invocation.generateCC1CommandLine(GeneratedArgs, *this); - ASSERT_THAT(GeneratedArgs, Contains(StrEq(PassManagerChangedByFlag))); - ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq(PassManagerResetByFlag)))); + ASSERT_THAT(GeneratedArgs, Contains(StrEq("-flegacy-pass-manager"))); + ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq("-fno-legacy-pass-manager")))); } TEST_F(CommandLineTest, BoolOptionDefaultArbitraryTwoFlagsPresentReset) { - const char *Args[] = {PassManagerResetByFlag}; + const char *Args[] = {"-fno-legacy-pass-manager"}; ASSERT_TRUE(CompilerInvocation::CreateFromArgs(Invocation, Args, *Diags)); - ASSERT_EQ(Invocation.getCodeGenOpts().LegacyPassManager, PassManagerDefault); + ASSERT_EQ(Invocation.getCodeGenOpts().LegacyPassManager, false); Invocation.generateCC1CommandLine(GeneratedArgs, *this); - ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq(PassManagerResetByFlag)))); - ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq(PassManagerChangedByFlag)))); + ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq("-fno-legacy-pass-manager")))); + ASSERT_THAT(GeneratedArgs, Not(Contains(StrEq("-flegacy-pass-manager")))); } // Boolean option that gets the CC1Option flag from a let statement (which diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp --- a/lld/COFF/Driver.cpp +++ b/lld/COFF/Driver.cpp @@ -1679,7 +1679,7 @@ if (args.hasArg(OPT_profile)) icfLevel = ICFLevel::None; unsigned tailMerge = 1; - bool ltoNewPM = LLVM_ENABLE_NEW_PASS_MANAGER; + bool ltoNewPM = true; bool ltoDebugPM = false; for (auto *arg : args.filtered(OPT_opt)) { std::string str = StringRef(arg->getValue()).lower(); diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -1102,9 +1102,8 @@ OPT_no_lto_pgo_warn_mismatch, true); config->ltoDebugPassManager = args.hasArg(OPT_lto_debug_pass_manager); config->ltoEmitAsm = args.hasArg(OPT_lto_emit_asm); - config->ltoNewPassManager = - args.hasFlag(OPT_no_lto_legacy_pass_manager, OPT_lto_legacy_pass_manager, - LLVM_ENABLE_NEW_PASS_MANAGER); + config->ltoNewPassManager = args.hasFlag(OPT_no_lto_legacy_pass_manager, + OPT_lto_legacy_pass_manager, true); config->ltoNewPmPasses = args.getLastArgValue(OPT_lto_newpm_passes); config->ltoWholeProgramVisibility = args.hasFlag(OPT_lto_whole_program_visibility, diff --git a/lld/MachO/Config.h b/lld/MachO/Config.h --- a/lld/MachO/Config.h +++ b/lld/MachO/Config.h @@ -107,7 +107,7 @@ bool implicitDylibs = false; bool isPic = false; bool headerPadMaxInstallNames = false; - bool ltoNewPassManager = LLVM_ENABLE_NEW_PASS_MANAGER; + bool ltoNewPassManager = true; bool markDeadStrippableDylib = false; bool printDylibSearch = false; bool printEachFile = false; diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp --- a/lld/MachO/Driver.cpp +++ b/lld/MachO/Driver.cpp @@ -1222,9 +1222,8 @@ config->umbrella = arg->getValue(); } config->ltoObjPath = args.getLastArgValue(OPT_object_path_lto); - config->ltoNewPassManager = - args.hasFlag(OPT_no_lto_legacy_pass_manager, OPT_lto_legacy_pass_manager, - LLVM_ENABLE_NEW_PASS_MANAGER); + config->ltoNewPassManager = args.hasFlag(OPT_no_lto_legacy_pass_manager, + OPT_lto_legacy_pass_manager, true); config->ltoo = args::getInteger(args, OPT_lto_O, 2); if (config->ltoo > 3) error("--lto-O: invalid optimization level: " + Twine(config->ltoo)); diff --git a/lld/wasm/Driver.cpp b/lld/wasm/Driver.cpp --- a/lld/wasm/Driver.cpp +++ b/lld/wasm/Driver.cpp @@ -365,9 +365,8 @@ config->importUndefined = args.hasArg(OPT_import_undefined); config->ltoo = args::getInteger(args, OPT_lto_O, 2); config->ltoPartitions = args::getInteger(args, OPT_lto_partitions, 1); - config->ltoNewPassManager = - args.hasFlag(OPT_no_lto_legacy_pass_manager, OPT_lto_legacy_pass_manager, - LLVM_ENABLE_NEW_PASS_MANAGER); + config->ltoNewPassManager = args.hasFlag(OPT_no_lto_legacy_pass_manager, + OPT_lto_legacy_pass_manager, true); config->ltoDebugPassManager = args.hasArg(OPT_lto_debug_pass_manager); config->mapFile = args.getLastArgValue(OPT_Map); config->optimize = args::getInteger(args, OPT_O, 1); diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt --- a/llvm/CMakeLists.txt +++ b/llvm/CMakeLists.txt @@ -767,9 +767,8 @@ set(LLVM_ENABLE_NEW_PASS_MANAGER TRUE CACHE BOOL "Enable the new pass manager by default.") if(NOT LLVM_ENABLE_NEW_PASS_MANAGER) - message(WARNING "Using the legacy pass manager for the optimization pipeline" - " is deprecated. The functionality will degrade over time and" - " be removed in a future release.") + message(FATAL_ERROR "Enabling the legacy pass manager on the cmake level is" + " no longer supported.") endif() include(HandleLLVMOptions) diff --git a/llvm/cmake/modules/LLVMConfig.cmake.in b/llvm/cmake/modules/LLVMConfig.cmake.in --- a/llvm/cmake/modules/LLVMConfig.cmake.in +++ b/llvm/cmake/modules/LLVMConfig.cmake.in @@ -88,8 +88,6 @@ set(LLVM_BUILD_32_BITS @LLVM_BUILD_32_BITS@) -set(LLVM_ENABLE_NEW_PASS_MANAGER @LLVM_ENABLE_NEW_PASS_MANAGER@) - if (NOT "@LLVM_PTHREAD_LIB@" STREQUAL "") set(LLVM_PTHREAD_LIB "@LLVM_PTHREAD_LIB@") endif() diff --git a/llvm/docs/NewPassManager.rst b/llvm/docs/NewPassManager.rst --- a/llvm/docs/NewPassManager.rst +++ b/llvm/docs/NewPassManager.rst @@ -481,9 +481,8 @@ with the legacy PM. For the optimization pipeline, the new PM is the default PM. The legacy PM is -available for the optimization pipeline either by setting the CMake flag -``-DLLVM_ENABLE_NEW_PASS_MANAGER=OFF`` when building LLVM, or by -various compiler/linker flags, e.g. ``-flegacy-pass-manager`` for ``clang``. +available for the optimization pipeline by setting various compiler/linker +flags, e.g. ``-flegacy-pass-manager`` for ``clang``. There will be efforts to deprecate and remove the legacy PM for the optimization pipeline in the future. diff --git a/llvm/include/llvm/Config/llvm-config.h.cmake b/llvm/include/llvm/Config/llvm-config.h.cmake --- a/llvm/include/llvm/Config/llvm-config.h.cmake +++ b/llvm/include/llvm/Config/llvm-config.h.cmake @@ -97,9 +97,6 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SYSEXITS_H ${HAVE_SYSEXITS_H} -/* Define to 1 to enable the experimental new pass manager by default */ -#cmakedefine01 LLVM_ENABLE_NEW_PASS_MANAGER - /* Define if the xar_open() function is supported on this platform. */ #cmakedefine LLVM_HAVE_LIBXAR ${LLVM_HAVE_LIBXAR} diff --git a/llvm/include/llvm/LTO/Config.h b/llvm/include/llvm/LTO/Config.h --- a/llvm/include/llvm/LTO/Config.h +++ b/llvm/include/llvm/LTO/Config.h @@ -58,7 +58,7 @@ bool DisableVerify = false; /// Use the new pass manager - bool UseNewPM = LLVM_ENABLE_NEW_PASS_MANAGER; + bool UseNewPM = true; /// Use the standard optimization pipeline. bool UseDefaultPipeline = false; diff --git a/llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h b/llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h --- a/llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h +++ b/llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h @@ -349,7 +349,7 @@ /// Flag to indicate whether the new pass manager should be used for IR /// optimizations. - bool UseNewPM = LLVM_ENABLE_NEW_PASS_MANAGER; + bool UseNewPM = true; /// Flag to indicate whether debug output should be enabled for the new pass /// manager. diff --git a/llvm/tools/gold/gold-plugin.cpp b/llvm/tools/gold/gold-plugin.cpp --- a/llvm/tools/gold/gold-plugin.cpp +++ b/llvm/tools/gold/gold-plugin.cpp @@ -201,7 +201,7 @@ // Sample profile file path static std::string sample_profile; // New pass manager - static bool new_pass_manager = LLVM_ENABLE_NEW_PASS_MANAGER; + static bool new_pass_manager = true; // Debug new pass manager static bool debug_pass_manager = false; // Directory to store the .dwo files. diff --git a/llvm/tools/llvm-lto/llvm-lto.cpp b/llvm/tools/llvm-lto/llvm-lto.cpp --- a/llvm/tools/llvm-lto/llvm-lto.cpp +++ b/llvm/tools/llvm-lto/llvm-lto.cpp @@ -256,9 +256,10 @@ cl::desc("Instead of running LTO, print the mach-o cpu in each IR file"), cl::cat(LTOCategory)); -static cl::opt UseNewPM( - "use-new-pm", cl::desc("Run LTO passes using the new pass manager"), - cl::init(LLVM_ENABLE_NEW_PASS_MANAGER), cl::Hidden, cl::cat(LTOCategory)); +static cl::opt + UseNewPM("use-new-pm", + cl::desc("Run LTO passes using the new pass manager"), + cl::init(true), cl::Hidden, cl::cat(LTOCategory)); static cl::opt DebugPassManager("debug-pass-manager", cl::init(false), cl::Hidden, diff --git a/llvm/tools/llvm-lto2/llvm-lto2.cpp b/llvm/tools/llvm-lto2/llvm-lto2.cpp --- a/llvm/tools/llvm-lto2/llvm-lto2.cpp +++ b/llvm/tools/llvm-lto2/llvm-lto2.cpp @@ -146,7 +146,7 @@ static cl::opt UseNewPM("use-new-pm", cl::desc("Run LTO passes using the new pass manager"), - cl::init(LLVM_ENABLE_NEW_PASS_MANAGER), cl::Hidden); + cl::init(true), cl::Hidden); static cl::opt DebugPassManager("debug-pass-manager", cl::init(false), cl::Hidden, diff --git a/llvm/tools/opt/opt.cpp b/llvm/tools/opt/opt.cpp --- a/llvm/tools/opt/opt.cpp +++ b/llvm/tools/opt/opt.cpp @@ -75,7 +75,7 @@ cl::desc("Enable the new pass manager, translating " "'opt -foo' to 'opt -passes=foo'. This is strictly for the new PM " "migration, use '-passes=' when possible."), - cl::init(LLVM_ENABLE_NEW_PASS_MANAGER)); + cl::init(true)); // This flag specifies a textual description of the optimization pass pipeline // to run over the module. This flag switches opt to use the new pass manager diff --git a/llvm/utils/gn/secondary/clang/test/BUILD.gn b/llvm/utils/gn/secondary/clang/test/BUILD.gn --- a/llvm/utils/gn/secondary/clang/test/BUILD.gn +++ b/llvm/utils/gn/secondary/clang/test/BUILD.gn @@ -60,7 +60,6 @@ "CMAKE_CXX_COMPILER=c++", "CMAKE_C_COMPILER=cc", "ENABLE_BACKTRACES=1", - "LLVM_ENABLE_NEW_PASS_MANAGER=1", "LLVM_EXTERNAL_LIT=", "LLVM_HOST_TRIPLE=$llvm_current_triple", "LLVM_LIT_TOOLS_DIR=", # Intentionally empty, matches cmake build. diff --git a/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn b/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn --- a/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn +++ b/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn @@ -335,7 +335,6 @@ "LLVM_BUILD_SHARED_LIBS=", "LLVM_DEFAULT_TARGET_TRIPLE=$llvm_target_triple", "LLVM_ENABLE_DUMP=", - "LLVM_ENABLE_NEW_PASS_MANAGER=1", "LLVM_FORCE_ENABLE_STATS=", "LLVM_FORCE_USE_OLD_TOOLCHAIN=", "LLVM_HAS_ATOMICS=1", diff --git a/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/llvm-config.h b/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/llvm-config.h --- a/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/llvm-config.h +++ b/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/llvm-config.h @@ -105,9 +105,6 @@ /* Define to 1 if you have the header file. */ /* HAVE_SYSEXITS_H defined in Bazel */ -/* Define to 1 to enable the experimental new pass manager by default */ -#define LLVM_ENABLE_NEW_PASS_MANAGER 0 - /* Define if the xar_open() function is supported this platform. */ /* #undef HAVE_LIBXAR */ diff --git a/utils/bazel/llvm_configs/llvm-config.h.cmake b/utils/bazel/llvm_configs/llvm-config.h.cmake --- a/utils/bazel/llvm_configs/llvm-config.h.cmake +++ b/utils/bazel/llvm_configs/llvm-config.h.cmake @@ -97,9 +97,6 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SYSEXITS_H ${HAVE_SYSEXITS_H} -/* Define to 1 to enable the experimental new pass manager by default */ -#cmakedefine01 LLVM_ENABLE_NEW_PASS_MANAGER - /* Define if the xar_open() function is supported on this platform. */ #cmakedefine LLVM_HAVE_LIBXAR ${LLVM_HAVE_LIBXAR}