diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt index f947b820bdac..8c539e80946d 100644 --- a/clang/CMakeLists.txt +++ b/clang/CMakeLists.txt @@ -242,6 +242,9 @@ set(ENABLE_LINKER_BUILD_ID OFF CACHE BOOL "pass --build-id to ld") set(ENABLE_X86_RELAX_RELOCATIONS ON CACHE BOOL "enable x86 relax relocations by default") +set(ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER FALSE CACHE BOOL + "Enable the experimental new pass manager by default.") + set(CLANG_SPAWN_CC1 OFF CACHE BOOL "Whether clang should use a new process for the CC1 invocation") diff --git a/clang/include/clang/Config/config.h.cmake b/clang/include/clang/Config/config.h.cmake index a240862c5289..26e9d5c4eb4d 100644 --- a/clang/include/clang/Config/config.h.cmake +++ b/clang/include/clang/Config/config.h.cmake @@ -75,6 +75,9 @@ /* enable x86 relax relocations by default */ #cmakedefine01 ENABLE_X86_RELAX_RELOCATIONS +/* Enable the experimental new pass manager by default */ +#cmakedefine01 ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER + /* Enable each functionality of modules */ #cmakedefine01 CLANG_ENABLE_ARCMT #cmakedefine01 CLANG_ENABLE_OBJC_REWRITER diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 6e37a3154bdf..48d0e2d6235b 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -1349,7 +1349,7 @@ def fglobal_isel : Flag<["-"], "fglobal-isel">, Group, def fexperimental_isel : Flag<["-"], "fexperimental-isel">, Group, Alias; defm experimental_new_pass_manager : BooleanMarshalledFFlag<"experimental-new-pass-manager", "CodeGenOpts.ExperimentalNewPassManager", - "static_cast(LLVM_ENABLE_NEW_PASS_MANAGER)", "Enables an experimental new pass manager in LLVM.", + "static_cast(ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER)", "Enables an experimental new pass manager in LLVM.", "Disables an experimental new pass manager in LLVM.">, Group, Flags<[CC1Option]>; def fexperimental_strict_floating_point : Flag<["-"], "fexperimental-strict-floating-point">, Group, Flags<[CC1Option]>, diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp index 034fab229ef6..d765b4cb598d 100644 --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -37,7 +37,6 @@ #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringSwitch.h" #include "llvm/ADT/Twine.h" -#include "llvm/Config/llvm-config.h" #include "llvm/Option/Arg.h" #include "llvm/Option/ArgList.h" #include "llvm/Option/Option.h" @@ -598,7 +597,7 @@ void tools::addLTOOptions(const ToolChain &ToolChain, const ArgList &Args, // 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, - /* Default */ LLVM_ENABLE_NEW_PASS_MANAGER)) { + /* Default */ ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER)) { CmdArgs.push_back("-plugin-opt=new-pass-manager"); } diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 068c8608ca65..f72e0fc10a32 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -58,7 +58,6 @@ #include "llvm/ADT/StringSwitch.h" #include "llvm/ADT/Triple.h" #include "llvm/ADT/Twine.h" -#include "llvm/Config/llvm-config.h" #include "llvm/IR/DebugInfoMetadata.h" #include "llvm/Linker/Linker.h" #include "llvm/MC/MCTargetOptions.h" diff --git a/clang/test/CMakeLists.txt b/clang/test/CMakeLists.txt index a913b35ed567..2aff029cfbf1 100644 --- a/clang/test/CMakeLists.txt +++ b/clang/test/CMakeLists.txt @@ -15,7 +15,7 @@ llvm_canonicalize_cmake_booleans( CLANG_ENABLE_STATIC_ANALYZER CLANG_SPAWN_CC1 ENABLE_BACKTRACES - LLVM_ENABLE_NEW_PASS_MANAGER + ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER LLVM_ENABLE_ZLIB LLVM_ENABLE_PER_TARGET_RUNTIME_DIR LLVM_ENABLE_PLUGINS diff --git a/clang/test/lit.site.cfg.py.in b/clang/test/lit.site.cfg.py.in index eb01720249af..9cbb6eb7081a 100644 --- a/clang/test/lit.site.cfg.py.in +++ b/clang/test/lit.site.cfg.py.in @@ -24,7 +24,7 @@ config.clang_staticanalyzer_z3 = "@LLVM_WITH_Z3@" 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_experimental_new_pass_manager = @ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER@ config.enable_threads = @LLVM_ENABLE_THREADS@ config.host_arch = "@HOST_ARCH@" config.python_executable = "@Python3_EXECUTABLE@" diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt index 98a8f8dfbce4..1f43dd5eb390 100644 --- a/llvm/CMakeLists.txt +++ b/llvm/CMakeLists.txt @@ -697,9 +697,6 @@ else() endif() option(LLVM_ENABLE_PLUGINS "Enable plugin support" ${LLVM_ENABLE_PLUGINS_default}) -set(ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER FALSE CACHE BOOL - "Enable the experimental new pass manager by default.") - include(HandleLLVMOptions) find_package(Python3 COMPONENTS Interpreter) @@ -812,10 +809,6 @@ if (NOT TENSORFLOW_AOT_PATH STREQUAL "") ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/tf_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/include/llvm/Config/llvm-config.h.cmake b/llvm/include/llvm/Config/llvm-config.h.cmake index b5fa20f789a6..452c56e408de 100644 --- a/llvm/include/llvm/Config/llvm-config.h.cmake +++ b/llvm/include/llvm/Config/llvm-config.h.cmake @@ -91,7 +91,4 @@ /* 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 - #endif diff --git a/llvm/utils/gn/secondary/clang/include/clang/Config/BUILD.gn b/llvm/utils/gn/secondary/clang/include/clang/Config/BUILD.gn index 66c5a17a64a5..49fc477d35f6 100644 --- a/llvm/utils/gn/secondary/clang/include/clang/Config/BUILD.gn +++ b/llvm/utils/gn/secondary/clang/include/clang/Config/BUILD.gn @@ -34,6 +34,7 @@ write_cmake_config("Config") { "BACKEND_PACKAGE_STRING=LLVM ${llvm_version}git", "ENABLE_LINKER_BUILD_ID=", "ENABLE_X86_RELAX_RELOCATIONS=1", + "ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER=", "CLANG_ENABLE_OBJC_REWRITER=1", # FIXME: flag? "CLANG_SYSTEMZ_DEFAULT_ARCH=z10", ] diff --git a/llvm/utils/gn/secondary/clang/test/BUILD.gn b/llvm/utils/gn/secondary/clang/test/BUILD.gn index e8781bec188a..c5bb60bb54e8 100644 --- a/llvm/utils/gn/secondary/clang/test/BUILD.gn +++ b/llvm/utils/gn/secondary/clang/test/BUILD.gn @@ -57,7 +57,7 @@ write_lit_config("lit_site_cfg") { # builds exist, to make sure it's a toolchain var. "CMAKE_CXX_COMPILER=c++", "ENABLE_BACKTRACES=1", - "LLVM_ENABLE_NEW_PASS_MANAGER=0", + "ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER=0", "LLVM_HOST_TRIPLE=$llvm_current_triple", "LLVM_LIT_TOOLS_DIR=", # Intentionally empty, matches cmake build. "LLVM_USE_SANITIZER=", diff --git a/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn b/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn index 389d5e962bc9..8e0f9225e0f5 100644 --- a/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn +++ b/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn @@ -346,7 +346,6 @@ write_cmake_config("llvm-config") { "LLVM_VERSION_PATCH=$llvm_version_patch", "LLVM_WITH_Z3=", "PACKAGE_VERSION=${llvm_version}git", - "LLVM_ENABLE_NEW_PASS_MANAGER=", ] if (current_os == "win") {