Index: clang/include/clang/Driver/Options.td =================================================================== --- clang/include/clang/Driver/Options.td +++ 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; Index: clang/test/CMakeLists.txt =================================================================== --- clang/test/CMakeLists.txt +++ 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 Index: clang/test/lit.cfg.py =================================================================== --- clang/test/lit.cfg.py +++ 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') Index: clang/test/lit.site.cfg.py.in =================================================================== --- clang/test/lit.site.cfg.py.in +++ 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@" Index: clang/unittests/Frontend/CompilerInvocationTest.cpp =================================================================== --- clang/unittests/Frontend/CompilerInvocationTest.cpp +++ 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 Index: lld/COFF/Driver.cpp =================================================================== --- lld/COFF/Driver.cpp +++ 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(); Index: lld/ELF/Driver.cpp =================================================================== --- lld/ELF/Driver.cpp +++ lld/ELF/Driver.cpp @@ -1104,7 +1104,7 @@ 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); + true); config->ltoNewPmPasses = args.getLastArgValue(OPT_lto_newpm_passes); config->ltoWholeProgramVisibility = args.hasFlag(OPT_lto_whole_program_visibility, Index: lld/MachO/Config.h =================================================================== --- lld/MachO/Config.h +++ 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; Index: lld/MachO/Driver.cpp =================================================================== --- lld/MachO/Driver.cpp +++ lld/MachO/Driver.cpp @@ -1224,7 +1224,7 @@ 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); + true); config->ltoo = args::getInteger(args, OPT_lto_O, 2); if (config->ltoo > 3) error("--lto-O: invalid optimization level: " + Twine(config->ltoo)); Index: lld/wasm/Driver.cpp =================================================================== --- lld/wasm/Driver.cpp +++ lld/wasm/Driver.cpp @@ -367,7 +367,7 @@ 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); + true); config->ltoDebugPassManager = args.hasArg(OPT_lto_debug_pass_manager); config->mapFile = args.getLastArgValue(OPT_Map); config->optimize = args::getInteger(args, OPT_O, 1); Index: llvm/CMakeLists.txt =================================================================== --- llvm/CMakeLists.txt +++ 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) Index: llvm/cmake/modules/LLVMConfig.cmake.in =================================================================== --- llvm/cmake/modules/LLVMConfig.cmake.in +++ 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() Index: llvm/docs/NewPassManager.rst =================================================================== --- llvm/docs/NewPassManager.rst +++ 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. Index: llvm/include/llvm/Config/llvm-config.h.cmake =================================================================== --- llvm/include/llvm/Config/llvm-config.h.cmake +++ 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} Index: llvm/include/llvm/LTO/Config.h =================================================================== --- llvm/include/llvm/LTO/Config.h +++ 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; Index: llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h =================================================================== --- llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h +++ 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. Index: llvm/tools/gold/gold-plugin.cpp =================================================================== --- llvm/tools/gold/gold-plugin.cpp +++ 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. Index: llvm/tools/llvm-lto/llvm-lto.cpp =================================================================== --- llvm/tools/llvm-lto/llvm-lto.cpp +++ llvm/tools/llvm-lto/llvm-lto.cpp @@ -258,7 +258,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::cat(LTOCategory)); + cl::init(true), cl::Hidden, cl::cat(LTOCategory)); static cl::opt DebugPassManager("debug-pass-manager", cl::init(false), cl::Hidden, Index: llvm/tools/llvm-lto2/llvm-lto2.cpp =================================================================== --- llvm/tools/llvm-lto2/llvm-lto2.cpp +++ 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, Index: llvm/tools/opt/opt.cpp =================================================================== --- llvm/tools/opt/opt.cpp +++ 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 Index: llvm/utils/gn/secondary/clang/test/BUILD.gn =================================================================== --- llvm/utils/gn/secondary/clang/test/BUILD.gn +++ 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. Index: llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn =================================================================== --- llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn +++ 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", Index: utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/llvm-config.h =================================================================== --- utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/llvm-config.h +++ 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 */ Index: utils/bazel/llvm_configs/llvm-config.h.cmake =================================================================== --- utils/bazel/llvm_configs/llvm-config.h.cmake +++ 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}