diff --git a/clang/cmake/caches/Fuchsia-stage2.cmake b/clang/cmake/caches/Fuchsia-stage2.cmake --- a/clang/cmake/caches/Fuchsia-stage2.cmake +++ b/clang/cmake/caches/Fuchsia-stage2.cmake @@ -41,7 +41,6 @@ set(CLANG_ENABLE_STATIC_ANALYZER ON CACHE BOOL "") set(CLANG_PLUGIN_SUPPORT OFF CACHE BOOL "") -set(ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER ON CACHE BOOL "") set(ENABLE_LINKER_BUILD_ID ON CACHE BOOL "") set(ENABLE_X86_RELAX_RELOCATIONS ON CACHE BOOL "") diff --git a/clang/cmake/caches/Fuchsia.cmake b/clang/cmake/caches/Fuchsia.cmake --- a/clang/cmake/caches/Fuchsia.cmake +++ b/clang/cmake/caches/Fuchsia.cmake @@ -32,7 +32,6 @@ set(CLANG_ENABLE_STATIC_ANALYZER ON CACHE BOOL "") set(CLANG_PLUGIN_SUPPORT OFF CACHE BOOL "") -set(ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER ON CACHE BOOL "") set(ENABLE_LINKER_BUILD_ID ON CACHE BOOL "") set(ENABLE_X86_RELAX_RELOCATIONS ON CACHE BOOL "") 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 @@ -1873,7 +1873,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 @@ -15,7 +15,6 @@ CLANG_ENABLE_STATIC_ANALYZER CLANG_SPAWN_CC1 ENABLE_BACKTRACES - LLVM_ENABLE_NEW_PASS_MANAGER LLVM_ENABLE_ZLIB LLVM_ENABLE_PER_TARGET_RUNTIME_DIR LLVM_ENABLE_PLUGINS diff --git a/clang/test/CodeGen/flatten.c b/clang/test/CodeGen/flatten.c --- a/clang/test/CodeGen/flatten.c +++ b/clang/test/CodeGen/flatten.c @@ -1,4 +1,4 @@ -// UNSUPPORTED: experimental-new-pass-manager +// XFAIL: * // Currently, different code seems to be intentionally generated under the new // PM since we alwaysinline functions and not callsites under new PM. // Under new PM, f() will not be inlined from g() since f is not marked as diff --git a/clang/test/CodeGenCXX/flatten.cpp b/clang/test/CodeGenCXX/flatten.cpp --- a/clang/test/CodeGenCXX/flatten.cpp +++ b/clang/test/CodeGenCXX/flatten.cpp @@ -1,4 +1,4 @@ -// UNSUPPORTED: experimental-new-pass-manager +// XFAIL: * // See the comment for CodeGen/flatten.c on why this is unsupported with the new // PM. 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 @@ -131,10 +131,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 @@ -28,7 +28,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,16 +259,12 @@ // 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 unsigned PassManagerDefault = 0; static constexpr const char *PassManagerResetByFlag = - LLVM_ENABLE_NEW_PASS_MANAGER ? "-fno-legacy-pass-manager" - : "-flegacy-pass-manager"; + "-fno-legacy-pass-manager"; -static constexpr const char *PassManagerChangedByFlag = - LLVM_ENABLE_NEW_PASS_MANAGER ? "-flegacy-pass-manager" - : "-fno-legacy-pass-manager"; +static constexpr const char *PassManagerChangedByFlag = "-flegacy-pass-manager"; TEST_F(CommandLineTest, BoolOptionDefaultArbitraryTwoFlagsPresentNone) { const char *Args = {""}; diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp --- a/lld/COFF/Driver.cpp +++ b/lld/COFF/Driver.cpp @@ -1591,7 +1591,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 @@ -1073,9 +1073,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 @@ -106,7 +106,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 @@ -1206,9 +1206,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 @@ -374,9 +374,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 @@ -701,9 +701,6 @@ endif() option(LLVM_ENABLE_PLUGINS "Enable plugin support" ${LLVM_ENABLE_PLUGINS_default}) -set(ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER TRUE CACHE BOOL - "Enable the new pass manager by default.") - include(HandleLLVMOptions) find_package(Python3 ${LLVM_MINIMUM_PYTHON_VERSION} REQUIRED @@ -841,10 +838,6 @@ set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS tf_xla_runtime) endif() -# Keep the legacy CMake flag ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER for -# compatibility. -set(LLVM_ENABLE_NEW_PASS_MANAGER ${ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER}) - # Configure the three LLVM configuration header files. configure_file( ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/config.h.cmake 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 @@ -76,8 +76,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 @@ -448,9 +448,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 -``-DENABLE_EXPERIMENTAL_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 either by 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 @@ -94,9 +94,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; /// Flag to indicate that the optimizer should not assume builtins are present /// on the target. 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 @@ -350,7 +350,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 @@ -255,9 +255,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 @@ -145,7 +145,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 @@ -74,7 +74,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 @@ -58,7 +58,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 @@ -326,7 +326,6 @@ values = [ "LLVM_DEFAULT_TARGET_TRIPLE=$llvm_target_triple", "LLVM_ENABLE_DUMP=", - "LLVM_ENABLE_NEW_PASS_MANAGER=1", "LLVM_FORCE_ENABLE_STATS=", "LLVM_HAS_ATOMICS=1", "LLVM_HAVE_TF_AOT=",