diff options
author | Lone_Wolf | 2023-03-21 13:45:46 +0100 |
---|---|---|
committer | Lone_Wolf | 2023-03-21 13:45:46 +0100 |
commit | d3f6306991a7c70596416c10e47cab5031a46dbc (patch) | |
tree | 937e26a2f24d9afa086bf93720ada7aebec6ae11 | |
parent | b1c5b4009aa8ba5f70547e23f310b7d9e60fcebf (diff) | |
download | aur-d3f6306991a7c70596416c10e47cab5031a46dbc.tar.gz |
mesa-minimal-git is patched to work with curren tllvm trunk, reverts for now not needed
-rw-r--r-- | .SRCINFO | 45 | ||||
-rw-r--r-- | 0001-IPSCCP-Remove-legacy-pass.patch | 230 | ||||
-rw-r--r-- | 0002-OCaml-Remove-all-PassManager-related-functions.patch | 1622 | ||||
-rw-r--r-- | 0003-IPO-Remove-various-legacy-passes.patch | 826 | ||||
-rw-r--r-- | 0004-llvm-c-Remove-bindings-for-creating-legacy-passes.patch | 714 | ||||
-rw-r--r-- | 0005-llvm-c-Remove-PassManagerBuilder-APIs.patch | 239 | ||||
-rw-r--r-- | 0006-llvm-c-Remove-pointee-support-from-LLVMGetElementTyp.patch | 56 | ||||
-rw-r--r-- | 0007-Passes-Remove-some-legacy-passes.patch | 1154 | ||||
-rw-r--r-- | 0008-PassManagerBuilder-Remove-PassManagerBuilder.patch | 634 | ||||
-rw-r--r-- | 0009-ConstExpr-Remove-select-constant-expression.patch | 1021 | ||||
-rw-r--r-- | 0010-docs-Mention-removal-of-legacy-optimization-pipeline.patch | 36 | ||||
-rw-r--r-- | 0011-Fix-LLVM-Sphinx-build.patch | 27 | ||||
-rw-r--r-- | 0012-Passes-Remove-some-legacy-passes.patch | 487 | ||||
-rw-r--r-- | 0013-opt-Rename-enable-new-pm-bugpoint-enable-legacy-pm.patch | 176 | ||||
-rw-r--r-- | PKGBUILD | 68 |
15 files changed, 6 insertions, 7329 deletions
@@ -1,5 +1,5 @@ pkgbase = llvm-minimal-git - pkgver = 17.0.0_r455043.b1e9baea3a2c + pkgver = 17.0.0_r455308.3e2d4e85d347 pkgrel = 1 url = https://llvm.org/ arch = x86_64 @@ -21,55 +21,16 @@ pkgbase = llvm-minimal-git source = llvm-project::git+https://github.com/llvm/llvm-project.git source = local://llvm-config.h source = git+https://github.com/KhronosGroup/SPIRV-LLVM-Translator.git - source = 0001-IPSCCP-Remove-legacy-pass.patch - source = 0002-OCaml-Remove-all-PassManager-related-functions.patch - source = 0003-IPO-Remove-various-legacy-passes.patch - source = 0004-llvm-c-Remove-bindings-for-creating-legacy-passes.patch - source = 0005-llvm-c-Remove-PassManagerBuilder-APIs.patch - source = 0006-llvm-c-Remove-pointee-support-from-LLVMGetElementTyp.patch - source = 0007-Passes-Remove-some-legacy-passes.patch - source = 0008-PassManagerBuilder-Remove-PassManagerBuilder.patch - source = 0009-ConstExpr-Remove-select-constant-expression.patch - source = 0010-docs-Mention-removal-of-legacy-optimization-pipeline.patch - source = 0011-Fix-LLVM-Sphinx-build.patch - source = 0012-Passes-Remove-some-legacy-passes.patch - source = 0013-opt-Rename-enable-new-pm-bugpoint-enable-legacy-pm.patch md5sums = SKIP md5sums = 295c343dcd457dc534662f011d7cff1a md5sums = SKIP - md5sums = 245054bc67dec3eb30329bbdeed171b1 - md5sums = 4c5ac9bca18c8a92280b1699f2f85a16 - md5sums = 179d535366bdb73c6b02850210aca69c - md5sums = 286194131e1b5df0fe50ecd0f1b58eb2 - md5sums = 9e7e1648b472f83b054bf8dcbfc74175 - md5sums = a4604d7858e1536af63f52dcbc47fbb8 - md5sums = a09eda7d75c717aeb882fdfa67b028c3 - md5sums = 6f07ebda99c0c0cab5bb2ff063e05152 - md5sums = b43ad443cb817e1e341d25f0de6ba248 - md5sums = 161e703a83b93d6266c47b9883e55541 - md5sums = 8ce50e0f42ed9f4d26fff1233d21c055 - md5sums = 5ae64f8df9f04ecba27765d2401b58b0 - md5sums = ff35711ebdb2833fc084f077c3cdc40f sha512sums = SKIP sha512sums = 75e743dea28b280943b3cc7f8bbb871b57d110a7f2b9da2e6845c1c36bf170dd883fca54e463f5f49e0c3effe07fbd0db0f8cf5a12a2469d3f792af21a73fcdd sha512sums = SKIP - sha512sums = 4c1e8a455163ceb1e7d3f09f5e68f731e47f2346a2f62e1fe97b19f54c16781efc0b75d52304fe9d4aa62512fd6f32b7bd6e12b319cbe72e7831f1a056ffbfd0 - sha512sums = 92f971db948e8acd4a55cb46ef28dc394c5df07f57844b63d82fc19436e2dfe7b184599ca17d84ef4fa63f6281628d8cc734d74dcc95bc0eee8a5e7c3778f49a - sha512sums = ab46bd37d540e9c62d99cc9e137079e077f032d0ba6531b0685d2bb91a4d832787dd12e3680c76b58d26ada7e81b3a7d8d138c303a6ffb21b593dc549aecb140 - sha512sums = d3f5df839b49e4a853e88efaf2fb31c36efb15a91b4803f7e52414ab0e3121f4bfafc7d39edaad52a29106ca648428577f97f4fd12e7575cd3bbe009a1111901 - sha512sums = 034b8262c2cec48fcdf1eef8f74332fc7016ecbf1627ab755f95f525c653cab0dd4199cd60b85dd09a63dc0b76bc9db9f85043c91801940294e42bc1feb1ea60 - sha512sums = 2f227060ab56e04bf3e74fbb785c2edf9fc55121c936ba17ac62275cacdacfb9cb84bfda0e6637e11e744e26212bbfa861fa320084502afb4b7fd247d832993b - sha512sums = 6d77c23ad97c057898d97fd08af9714ff18c43026e082ad5e654b736caffb1ba814de0ebb9a7e169de9475d819df3cd0058805e4a0f020c55ce3b2272181802a - sha512sums = 4e006cb70005a4116e8637d9dabf7d3f1668e5ad21429254b641fa9ee716c2822cc718cc91c58e29451e4ffde96d25abfd31813322b82b91f896656c05be1210 - sha512sums = af7ee9560ac9346a9424706c1f5e7536f985c7fae74d6342429a8d865bfee529d694f6b835c5dc76952d45392f077c2d756f55d41a28075d8c999f847c5242a6 - sha512sums = ed6ac398f3d7c141d789a700880a23ee0f7f82de87462a44941ede6ef9fea426138ce587077ded0265577c2a31b4de9ef7dfa4446be145bce8c1088092e6902b - sha512sums = 55036920d244f97d9e03de34558f6c20af57e26652acdb1db9f1ee5022c09984d2db2e2d71178b5440d46145ff8ff33c7fbc657195073f630a17a6e6bce42b82 - sha512sums = 852b52175aab6eb6193e0a6a1f8a6e0031061c73158a292472b20a7ac99f00e04d4c8ac266e99c1c2d7e91d8d071dd4d6ad1737a4a2ecc31085153c44f09f9d7 - sha512sums = 3e37d9449d74477c0fc2a6c3af37e06aba6555cc8cef83c71e74cb34e5a6ae3b6a5bc6c3fbb6b88c9cd0684e2e40ae066e1eb56337f8980a4729780bc7f9bdd3 pkgname = llvm-minimal-git pkgdesc = Collection of modular and reusable compiler and toolchain technologies - depends = llvm-libs-minimal-git=17.0.0_r455043.b1e9baea3a2c-1 + depends = llvm-libs-minimal-git=17.0.0_r455308.3e2d4e85d347-1 depends = perl optdepends = python: for using lit (LLVM Integrated Tester) optdepends = python-setuptools: for using lit @@ -93,7 +54,7 @@ pkgname = llvm-libs-minimal-git pkgname = spirv-llvm-translator-minimal-git pkgdesc = Tool and a library for bi-directional translation between SPIR-V and LLVM IR, trunk version - depends = llvm-minimal-git=17.0.0_r455043.b1e9baea3a2c-1 + depends = llvm-minimal-git=17.0.0_r455308.3e2d4e85d347-1 depends = spirv-tools-git provides = spirv-llvm-translator conflicts = spirv-llvm-translator diff --git a/0001-IPSCCP-Remove-legacy-pass.patch b/0001-IPSCCP-Remove-legacy-pass.patch deleted file mode 100644 index d9db03723545..000000000000 --- a/0001-IPSCCP-Remove-legacy-pass.patch +++ /dev/null @@ -1,230 +0,0 @@ -From b677d0753c0a771c6203607f5dbb56189193a14c Mon Sep 17 00:00:00 2001 -From: Arthur Eubanks <aeubanks@google.com> -Date: Tue, 14 Feb 2023 13:20:37 -0800 -Subject: [PATCH] [IPSCCP] Remove legacy pass - -This is part of the optimization pipeline, of which the legacy pass manager version is deprecated. ---- - .../bindings/ocaml/transforms/ipo/ipo_ocaml.c | 7 -- - .../bindings/ocaml/transforms/ipo/llvm_ipo.ml | 3 - - .../ocaml/transforms/ipo/llvm_ipo.mli | 6 +- - llvm/include/llvm-c/Transforms/IPO.h | 3 - - llvm/include/llvm/LinkAllPasses.h | 1 - - llvm/include/llvm/Transforms/IPO.h | 7 -- - llvm/lib/Transforms/IPO/IPO.cpp | 5 -- - .../lib/Transforms/IPO/PassManagerBuilder.cpp | 2 - - llvm/lib/Transforms/IPO/SCCP.cpp | 70 ------------------- - llvm/test/Bindings/OCaml/ipo.ml | 1 - - 10 files changed, 1 insertion(+), 104 deletions(-) - -diff --git a/llvm/bindings/ocaml/transforms/ipo/ipo_ocaml.c b/llvm/bindings/ocaml/transforms/ipo/ipo_ocaml.c -index 09450dc1a8ca..008d18e0822b 100644 ---- a/llvm/bindings/ocaml/transforms/ipo/ipo_ocaml.c -+++ b/llvm/bindings/ocaml/transforms/ipo/ipo_ocaml.c -@@ -48,10 +48,3 @@ value llvm_add_global_dce(LLVMPassManagerRef PM) { - LLVMAddGlobalDCEPass(PM); - return Val_unit; - } -- --/* [`Module] Llvm.PassManager.t -> unit */ --value llvm_add_ipsccp(LLVMPassManagerRef PM) { -- LLVMAddIPSCCPPass(PM); -- return Val_unit; --} -- -diff --git a/llvm/bindings/ocaml/transforms/ipo/llvm_ipo.ml b/llvm/bindings/ocaml/transforms/ipo/llvm_ipo.ml -index 3d7464956d01..e54ee494e7be 100644 ---- a/llvm/bindings/ocaml/transforms/ipo/llvm_ipo.ml -+++ b/llvm/bindings/ocaml/transforms/ipo/llvm_ipo.ml -@@ -21,6 +21,3 @@ external add_always_inliner - external add_global_dce - : [ `Module ] Llvm.PassManager.t -> unit - = "llvm_add_global_dce" --external add_ipsccp -- : [ `Module ] Llvm.PassManager.t -> unit -- = "llvm_add_ipsccp" -diff --git a/llvm/bindings/ocaml/transforms/ipo/llvm_ipo.mli b/llvm/bindings/ocaml/transforms/ipo/llvm_ipo.mli -index 03f3a183b95e..baa098495e9c 100644 ---- a/llvm/bindings/ocaml/transforms/ipo/llvm_ipo.mli -+++ b/llvm/bindings/ocaml/transforms/ipo/llvm_ipo.mli -@@ -35,8 +35,4 @@ external add_always_inliner - external add_global_dce - : [ `Module ] Llvm.PassManager.t -> unit - = "llvm_add_global_dce" -- --(** See the [llvm::createIPSCCPPass] function. *) --external add_ipsccp -- : [ `Module ] Llvm.PassManager.t -> unit -- = "llvm_add_ipsccp" -+ -\ No newline at end of file -diff --git a/llvm/include/llvm-c/Transforms/IPO.h b/llvm/include/llvm-c/Transforms/IPO.h -index f6fd7882ea65..53aa20fbd886 100644 ---- a/llvm/include/llvm-c/Transforms/IPO.h -+++ b/llvm/include/llvm-c/Transforms/IPO.h -@@ -42,9 +42,6 @@ void LLVMAddAlwaysInlinerPass(LLVMPassManagerRef PM); - /** See llvm::createGlobalDCEPass function. */ - void LLVMAddGlobalDCEPass(LLVMPassManagerRef PM); - --/** See llvm::createIPSCCPPass function. */ --void LLVMAddIPSCCPPass(LLVMPassManagerRef PM); -- - /** - * @} - */ -diff --git a/llvm/include/llvm/LinkAllPasses.h b/llvm/include/llvm/LinkAllPasses.h -index 9e3ac6fd821b..b5ab8d87629e 100644 ---- a/llvm/include/llvm/LinkAllPasses.h -+++ b/llvm/include/llvm/LinkAllPasses.h -@@ -97,7 +97,6 @@ namespace { - (void) llvm::createGlobalsAAWrapperPass(); - (void) llvm::createGuardWideningPass(); - (void) llvm::createLoopGuardWideningPass(); -- (void) llvm::createIPSCCPPass(); - (void) llvm::createInductiveRangeCheckEliminationPass(); - (void) llvm::createIndVarSimplifyPass(); - (void) llvm::createInstSimplifyLegacyPass(); -diff --git a/llvm/include/llvm/Transforms/IPO.h b/llvm/include/llvm/Transforms/IPO.h -index 297e69542064..4c6eb6f6e644 100644 ---- a/llvm/include/llvm/Transforms/IPO.h -+++ b/llvm/include/llvm/Transforms/IPO.h -@@ -76,13 +76,6 @@ ModulePass *createDeadArgEliminationPass(); - /// bugpoint. - ModulePass *createDeadArgHackingPass(); - --//===----------------------------------------------------------------------===// --/// createIPSCCPPass - This pass propagates constants from call sites into the --/// bodies of functions, and keeps track of whether basic blocks are executable --/// in the process. --/// --ModulePass *createIPSCCPPass(); -- - //===----------------------------------------------------------------------===// - // - /// createLoopExtractorPass - This pass extracts all natural loops from the -diff --git a/llvm/lib/Transforms/IPO/IPO.cpp b/llvm/lib/Transforms/IPO/IPO.cpp -index 7d95c761d3d5..6fa706a91b0b 100644 ---- a/llvm/lib/Transforms/IPO/IPO.cpp -+++ b/llvm/lib/Transforms/IPO/IPO.cpp -@@ -36,7 +36,6 @@ void llvm::initializeIPO(PassRegistry &Registry) { - initializeAttributorLegacyPassPass(Registry); - initializeAttributorCGSCCLegacyPassPass(Registry); - initializePostOrderFunctionAttrsLegacyPassPass(Registry); -- initializeIPSCCPLegacyPassPass(Registry); - initializeBarrierNoopPass(Registry); - initializeEliminateAvailableExternallyLegacyPassPass(Registry); - } -@@ -64,7 +63,3 @@ void LLVMAddAlwaysInlinerPass(LLVMPassManagerRef PM) { - void LLVMAddGlobalDCEPass(LLVMPassManagerRef PM) { - unwrap(PM)->add(createGlobalDCEPass()); - } -- --void LLVMAddIPSCCPPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createIPSCCPPass()); --} -diff --git a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp -index ce0792631ff1..893cca50efc4 100644 ---- a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp -+++ b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp -@@ -310,8 +310,6 @@ void PassManagerBuilder::populateModulePassManager( - if (OptLevel > 2) - MPM.add(createCallSiteSplittingPass()); - -- MPM.add(createIPSCCPPass()); // IP SCCP -- - // Promote any localized global vars. - MPM.add(createPromoteMemoryToRegisterPass()); - -diff --git a/llvm/lib/Transforms/IPO/SCCP.cpp b/llvm/lib/Transforms/IPO/SCCP.cpp -index 5c1582ddfdae..9675ec025cf9 100644 ---- a/llvm/lib/Transforms/IPO/SCCP.cpp -+++ b/llvm/lib/Transforms/IPO/SCCP.cpp -@@ -407,73 +407,3 @@ PreservedAnalyses IPSCCPPass::run(Module &M, ModuleAnalysisManager &AM) { - PA.preserve<FunctionAnalysisManagerModuleProxy>(); - return PA; - } -- --namespace { -- --//===--------------------------------------------------------------------===// --// --/// IPSCCP Class - This class implements interprocedural Sparse Conditional --/// Constant Propagation. --/// --class IPSCCPLegacyPass : public ModulePass { --public: -- static char ID; -- -- IPSCCPLegacyPass() : ModulePass(ID) { -- initializeIPSCCPLegacyPassPass(*PassRegistry::getPassRegistry()); -- } -- -- bool runOnModule(Module &M) override { -- if (skipModule(M)) -- return false; -- const DataLayout &DL = M.getDataLayout(); -- auto GetTLI = [this](Function &F) -> const TargetLibraryInfo & { -- return this->getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(F); -- }; -- auto GetTTI = [this](Function &F) -> TargetTransformInfo & { -- return this->getAnalysis<TargetTransformInfoWrapperPass>().getTTI(F); -- }; -- auto GetAC = [this](Function &F) -> AssumptionCache & { -- return this->getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F); -- }; -- auto getAnalysis = [this](Function &F) -> AnalysisResultsForFn { -- DominatorTree &DT = -- this->getAnalysis<DominatorTreeWrapperPass>(F).getDomTree(); -- return { -- std::make_unique<PredicateInfo>( -- F, DT, -- this->getAnalysis<AssumptionCacheTracker>().getAssumptionCache( -- F)), -- nullptr, // We cannot preserve the LI, DT or PDT with the legacy pass -- nullptr, // manager, so set them to nullptr. -- nullptr}; -- }; -- -- return runIPSCCP(M, DL, nullptr, GetTLI, GetTTI, GetAC, getAnalysis, false); -- } -- -- void getAnalysisUsage(AnalysisUsage &AU) const override { -- AU.addRequired<AssumptionCacheTracker>(); -- AU.addRequired<DominatorTreeWrapperPass>(); -- AU.addRequired<TargetLibraryInfoWrapperPass>(); -- AU.addRequired<TargetTransformInfoWrapperPass>(); -- } --}; -- --} // end anonymous namespace -- --char IPSCCPLegacyPass::ID = 0; -- --INITIALIZE_PASS_BEGIN(IPSCCPLegacyPass, "ipsccp", -- "Interprocedural Sparse Conditional Constant Propagation", -- false, false) --INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker) --INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass) --INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass) --INITIALIZE_PASS_END(IPSCCPLegacyPass, "ipsccp", -- "Interprocedural Sparse Conditional Constant Propagation", -- false, false) -- --// createIPSCCPPass - This is the public interface to this file. --ModulePass *llvm::createIPSCCPPass() { return new IPSCCPLegacyPass(); } -- -diff --git a/llvm/test/Bindings/OCaml/ipo.ml b/llvm/test/Bindings/OCaml/ipo.ml -index 124a9734ce23..9866de4e8ec1 100644 ---- a/llvm/test/Bindings/OCaml/ipo.ml -+++ b/llvm/test/Bindings/OCaml/ipo.ml -@@ -52,7 +52,6 @@ let test_transforms () = - ++ add_function_attrs - ++ add_always_inliner - ++ add_global_dce -- ++ add_ipsccp - ++ PassManager.run_module m - ++ PassManager.dispose) - --- -2.39.2 - diff --git a/0002-OCaml-Remove-all-PassManager-related-functions.patch b/0002-OCaml-Remove-all-PassManager-related-functions.patch deleted file mode 100644 index 49c5049c5f66..000000000000 --- a/0002-OCaml-Remove-all-PassManager-related-functions.patch +++ /dev/null @@ -1,1622 +0,0 @@ -From e0efe46b33068f2e651e850cdc3ede0306f1853c Mon Sep 17 00:00:00 2001 -From: Alan Hu <alanh@ccs.neu.edu> -Date: Fri, 24 Feb 2023 13:14:11 -0800 -Subject: [PATCH] [OCaml] Remove all PassManager-related functions - -Reviewed By: aeubanks, nikic - -Differential Revision: https://reviews.llvm.org/D144751 ---- - llvm/bindings/ocaml/llvm/llvm.ml | 18 -- - llvm/bindings/ocaml/llvm/llvm.mli | 51 ---- - llvm/bindings/ocaml/llvm/llvm_ocaml.c | 33 --- - llvm/bindings/ocaml/target/llvm_target.ml | 2 - - llvm/bindings/ocaml/target/llvm_target.mli | 4 - - llvm/bindings/ocaml/target/target_ocaml.c | 7 - - llvm/bindings/ocaml/transforms/CMakeLists.txt | 5 +- - .../ocaml/transforms/ipo/CMakeLists.txt | 5 - - .../bindings/ocaml/transforms/ipo/ipo_ocaml.c | 50 ---- - .../bindings/ocaml/transforms/ipo/llvm_ipo.ml | 23 -- - .../ocaml/transforms/ipo/llvm_ipo.mli | 38 --- - .../transforms/passmgr_builder/CMakeLists.txt | 5 - - .../passmgr_builder/llvm_passmgr_builder.ml | 28 --- - .../passmgr_builder/llvm_passmgr_builder.mli | 48 ---- - .../passmgr_builder/passmgr_builder_ocaml.c | 92 ------- - .../transforms/scalar_opts/CMakeLists.txt | 5 - - .../scalar_opts/llvm_scalar_opts.ml | 116 --------- - .../scalar_opts/llvm_scalar_opts.mli | 187 -------------- - .../scalar_opts/scalar_opts_ocaml.c | 231 ------------------ - .../ocaml/transforms/vectorize/CMakeLists.txt | 5 - - .../transforms/vectorize/llvm_vectorize.ml | 14 -- - .../transforms/vectorize/llvm_vectorize.mli | 22 -- - .../transforms/vectorize/vectorize_ocaml.c | 32 --- - llvm/docs/CMakeLists.txt | 4 - - llvm/test/Bindings/OCaml/core.ml | 24 -- - llvm/test/Bindings/OCaml/ipo.ml | 63 ----- - llvm/test/Bindings/OCaml/passmgr_builder.ml | 60 ----- - llvm/test/Bindings/OCaml/scalar_opts.ml | 87 ------- - llvm/test/Bindings/OCaml/target.ml | 4 +- - llvm/test/Bindings/OCaml/vectorize.ml | 55 ----- - llvm/test/CMakeLists.txt | 4 - - 31 files changed, 2 insertions(+), 1320 deletions(-) - delete mode 100644 llvm/bindings/ocaml/transforms/ipo/CMakeLists.txt - delete mode 100644 llvm/bindings/ocaml/transforms/ipo/ipo_ocaml.c - delete mode 100644 llvm/bindings/ocaml/transforms/ipo/llvm_ipo.ml - delete mode 100644 llvm/bindings/ocaml/transforms/ipo/llvm_ipo.mli - delete mode 100644 llvm/bindings/ocaml/transforms/passmgr_builder/CMakeLists.txt - delete mode 100644 llvm/bindings/ocaml/transforms/passmgr_builder/llvm_passmgr_builder.ml - delete mode 100644 llvm/bindings/ocaml/transforms/passmgr_builder/llvm_passmgr_builder.mli - delete mode 100644 llvm/bindings/ocaml/transforms/passmgr_builder/passmgr_builder_ocaml.c - delete mode 100644 llvm/bindings/ocaml/transforms/scalar_opts/CMakeLists.txt - delete mode 100644 llvm/bindings/ocaml/transforms/scalar_opts/llvm_scalar_opts.ml - delete mode 100644 llvm/bindings/ocaml/transforms/scalar_opts/llvm_scalar_opts.mli - delete mode 100644 llvm/bindings/ocaml/transforms/scalar_opts/scalar_opts_ocaml.c - delete mode 100644 llvm/bindings/ocaml/transforms/vectorize/CMakeLists.txt - delete mode 100644 llvm/bindings/ocaml/transforms/vectorize/llvm_vectorize.ml - delete mode 100644 llvm/bindings/ocaml/transforms/vectorize/llvm_vectorize.mli - delete mode 100644 llvm/bindings/ocaml/transforms/vectorize/vectorize_ocaml.c - delete mode 100644 llvm/test/Bindings/OCaml/ipo.ml - delete mode 100644 llvm/test/Bindings/OCaml/passmgr_builder.ml - delete mode 100644 llvm/test/Bindings/OCaml/scalar_opts.ml - delete mode 100644 llvm/test/Bindings/OCaml/vectorize.ml - -diff --git a/llvm/bindings/ocaml/llvm/llvm.ml b/llvm/bindings/ocaml/llvm/llvm.ml -index 10d44a6cf998..4487866891e4 100644 ---- a/llvm/bindings/ocaml/llvm/llvm.ml -+++ b/llvm/bindings/ocaml/llvm/llvm.ml -@@ -1392,21 +1392,3 @@ module MemoryBuffer = struct - external as_string : llmemorybuffer -> string = "llvm_memorybuffer_as_string" - external dispose : llmemorybuffer -> unit = "llvm_memorybuffer_dispose" - end -- -- --(*===-- Pass Manager ------------------------------------------------------===*) -- --module PassManager = struct -- type 'a t -- type any = [ `Module | `Function ] -- external create : unit -> [ `Module ] t = "llvm_passmanager_create" -- external create_function : llmodule -> [ `Function ] t -- = "LLVMCreateFunctionPassManager" -- external run_module : llmodule -> [ `Module ] t -> bool -- = "llvm_passmanager_run_module" -- external initialize : [ `Function ] t -> bool = "llvm_passmanager_initialize" -- external run_function : llvalue -> [ `Function ] t -> bool -- = "llvm_passmanager_run_function" -- external finalize : [ `Function ] t -> bool = "llvm_passmanager_finalize" -- external dispose : [< any ] t -> unit = "llvm_passmanager_dispose" --end -diff --git a/llvm/bindings/ocaml/llvm/llvm.mli b/llvm/bindings/ocaml/llvm/llvm.mli -index 38bf555d0230..59ac5b855130 100644 ---- a/llvm/bindings/ocaml/llvm/llvm.mli -+++ b/llvm/bindings/ocaml/llvm/llvm.mli -@@ -2622,54 +2622,3 @@ module MemoryBuffer : sig - (** Disposes of a memory buffer. *) - val dispose : llmemorybuffer -> unit - end -- -- --(** {6 Pass Managers} *) -- --module PassManager : sig -- (** *) -- type 'a t -- type any = [ `Module | `Function ] -- -- (** [PassManager.create ()] constructs a new whole-module pass pipeline. This -- type of pipeline is suitable for link-time optimization and whole-module -- transformations. -- See the constructor of [llvm::PassManager]. *) -- val create : unit -> [ `Module ] t -- -- (** [PassManager.create_function m] constructs a new function-by-function -- pass pipeline over the module [m]. It does not take ownership of [m]. -- This type of pipeline is suitable for code generation and JIT compilation -- tasks. -- See the constructor of [llvm::FunctionPassManager]. *) -- val create_function : llmodule -> [ `Function ] t -- -- (** [run_module m pm] initializes, executes on the module [m], and finalizes -- all of the passes scheduled in the pass manager [pm]. Returns [true] if -- any of the passes modified the module, [false] otherwise. -- See the [llvm::PassManager::run] method. *) -- val run_module : llmodule -> [ `Module ] t -> bool -- -- (** [initialize fpm] initializes all of the function passes scheduled in the -- function pass manager [fpm]. Returns [true] if any of the passes modified -- the module, [false] otherwise. -- See the [llvm::FunctionPassManager::doInitialization] method. *) -- val initialize : [ `Function ] t -> bool -- -- (** [run_function f fpm] executes all of the function passes scheduled in the -- function pass manager [fpm] over the function [f]. Returns [true] if any -- of the passes modified [f], [false] otherwise. -- See the [llvm::FunctionPassManager::run] method. *) -- val run_function : llvalue -> [ `Function ] t -> bool -- -- (** [finalize fpm] finalizes all of the function passes scheduled in the -- function pass manager [fpm]. Returns [true] if any of the passes -- modified the module, [false] otherwise. -- See the [llvm::FunctionPassManager::doFinalization] method. *) -- val finalize : [ `Function ] t -> bool -- -- (** Frees the memory of a pass pipeline. For function pipelines, does not free -- the module. -- See the destructor of [llvm::BasePassManager]. *) -- val dispose : [< any ] t -> unit --end -diff --git a/llvm/bindings/ocaml/llvm/llvm_ocaml.c b/llvm/bindings/ocaml/llvm/llvm_ocaml.c -index 0762ebef1bb0..dff14cf79c55 100644 ---- a/llvm/bindings/ocaml/llvm/llvm_ocaml.c -+++ b/llvm/bindings/ocaml/llvm/llvm_ocaml.c -@@ -2339,36 +2339,3 @@ value llvm_memorybuffer_dispose(LLVMMemoryBufferRef MemBuf) { - LLVMDisposeMemoryBuffer(MemBuf); - return Val_unit; - } -- --/*===-- Pass Managers -----------------------------------------------------===*/ -- --/* unit -> [ `Module ] PassManager.t */ --LLVMPassManagerRef llvm_passmanager_create(value Unit) { -- return LLVMCreatePassManager(); --} -- --/* llmodule -> [ `Function ] PassManager.t -> bool */ --value llvm_passmanager_run_module(LLVMModuleRef M, LLVMPassManagerRef PM) { -- return Val_bool(LLVMRunPassManager(PM, M)); --} -- --/* [ `Function ] PassManager.t -> bool */ --value llvm_passmanager_initialize(LLVMPassManagerRef FPM) { -- return Val_bool(LLVMInitializeFunctionPassManager(FPM)); --} -- --/* llvalue -> [ `Function ] PassManager.t -> bool */ --value llvm_passmanager_run_function(LLVMValueRef F, LLVMPassManagerRef FPM) { -- return Val_bool(LLVMRunFunctionPassManager(FPM, F)); --} -- --/* [ `Function ] PassManager.t -> bool */ --value llvm_passmanager_finalize(LLVMPassManagerRef FPM) { -- return Val_bool(LLVMFinalizeFunctionPassManager(FPM)); --} -- --/* PassManager.any PassManager.t -> unit */ --value llvm_passmanager_dispose(LLVMPassManagerRef PM) { -- LLVMDisposePassManager(PM); -- return Val_unit; --} -diff --git a/llvm/bindings/ocaml/target/llvm_target.ml b/llvm/bindings/ocaml/target/llvm_target.ml -index 0922ebe55345..29af0187f940 100644 ---- a/llvm/bindings/ocaml/target/llvm_target.ml -+++ b/llvm/bindings/ocaml/target/llvm_target.ml -@@ -122,8 +122,6 @@ module TargetMachine = struct - = "llvm_targetmachine_features" - external data_layout : t -> DataLayout.t - = "llvm_targetmachine_data_layout" -- external add_analysis_passes : [< Llvm.PassManager.any ] Llvm.PassManager.t -> t -> unit -- = "llvm_targetmachine_add_analysis_passes" - external set_verbose_asm : bool -> t -> unit - = "llvm_targetmachine_set_verbose_asm" - external emit_to_file : Llvm.llmodule -> CodeGenFileType.t -> string -> -diff --git a/llvm/bindings/ocaml/target/llvm_target.mli b/llvm/bindings/ocaml/target/llvm_target.mli -index 8d310793bea2..56ecb2d908dd 100644 ---- a/llvm/bindings/ocaml/target/llvm_target.mli -+++ b/llvm/bindings/ocaml/target/llvm_target.mli -@@ -200,10 +200,6 @@ module TargetMachine : sig - [llvm::TargetMachine::getFeatureString]. *) - val features : t -> string - -- (** Adds the target-specific analysis passes to the pass manager. -- See [llvm::TargetMachine::addAnalysisPasses]. *) -- val add_analysis_passes : [< Llvm.PassManager.any ] Llvm.PassManager.t -> t -> unit -- - (** Sets the assembly verbosity of this target machine. - See [llvm::TargetMachine::setAsmVerbosity]. *) - val set_verbose_asm : bool -> t -> unit -diff --git a/llvm/bindings/ocaml/target/target_ocaml.c b/llvm/bindings/ocaml/target/target_ocaml.c -index 2b7259bf2bc5..d0bc6f162f0d 100644 ---- a/llvm/bindings/ocaml/target/target_ocaml.c -+++ b/llvm/bindings/ocaml/target/target_ocaml.c -@@ -327,10 +327,3 @@ llvm_targetmachine_emit_to_memory_buffer(LLVMModuleRef Module, value FileType, - - return Buffer; - } -- --/* TargetMachine.t -> Llvm.PassManager.t -> unit */ --value llvm_targetmachine_add_analysis_passes(LLVMPassManagerRef PM, -- value Machine) { -- LLVMAddAnalysisPasses(TargetMachine_val(Machine), PM); -- return Val_unit; --} -diff --git a/llvm/bindings/ocaml/transforms/CMakeLists.txt b/llvm/bindings/ocaml/transforms/CMakeLists.txt -index beb8694019b7..0628d6763874 100644 ---- a/llvm/bindings/ocaml/transforms/CMakeLists.txt -+++ b/llvm/bindings/ocaml/transforms/CMakeLists.txt -@@ -1,5 +1,2 @@ --add_subdirectory(ipo) --add_subdirectory(passmgr_builder) --add_subdirectory(scalar_opts) - add_subdirectory(utils) --add_subdirectory(vectorize) -+ -diff --git a/llvm/bindings/ocaml/transforms/ipo/CMakeLists.txt b/llvm/bindings/ocaml/transforms/ipo/CMakeLists.txt -deleted file mode 100644 -index 4b8784fad67b..000000000000 ---- a/llvm/bindings/ocaml/transforms/ipo/CMakeLists.txt -+++ /dev/null -@@ -1,5 +0,0 @@ --add_ocaml_library(llvm_ipo -- OCAML llvm_ipo -- OCAMLDEP llvm -- C ipo_ocaml -- LLVM ipo) -diff --git a/llvm/bindings/ocaml/transforms/ipo/ipo_ocaml.c b/llvm/bindings/ocaml/transforms/ipo/ipo_ocaml.c -deleted file mode 100644 -index 008d18e0822b..000000000000 ---- a/llvm/bindings/ocaml/transforms/ipo/ipo_ocaml.c -+++ /dev/null -@@ -1,50 +0,0 @@ --/*===-- ipo_ocaml.c - LLVM OCaml Glue ---------------------------*- C++ -*-===*\ --|* *| --|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| --|* Exceptions. *| --|* See https://llvm.org/LICENSE.txt for license information. *| --|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| --|* *| --|*===----------------------------------------------------------------------===*| --|* *| --|* This file glues LLVM's OCaml interface to its C interface. These functions *| --|* are by and large transparent wrappers to the corresponding C functions. *| --|* *| --|* Note that these functions intentionally take liberties with the CAMLparamX *| --|* macros, since most of the parameters are not GC heap objects. *| --|* *| --\*===----------------------------------------------------------------------===*/ -- --#include "llvm-c/Transforms/IPO.h" --#include "caml/mlvalues.h" --#include "caml/misc.h" -- --/* [`Module] Llvm.PassManager.t -> unit */ --value llvm_add_constant_merge(LLVMPassManagerRef PM) { -- LLVMAddConstantMergePass(PM); -- return Val_unit; --} -- --/* [`Module] Llvm.PassManager.t -> unit */ --value llvm_add_dead_arg_elimination(LLVMPassManagerRef PM) { -- LLVMAddDeadArgEliminationPass(PM); -- return Val_unit; --} -- --/* [`Module] Llvm.PassManager.t -> unit */ --value llvm_add_function_attrs(LLVMPassManagerRef PM) { -- LLVMAddFunctionAttrsPass(PM); -- return Val_unit; --} -- --/* [`Module] Llvm.PassManager.t -> unit */ --value llvm_add_always_inliner(LLVMPassManagerRef PM) { -- LLVMAddAlwaysInlinerPass(PM); -- return Val_unit; --} -- --/* [`Module] Llvm.PassManager.t -> unit */ --value llvm_add_global_dce(LLVMPassManagerRef PM) { -- LLVMAddGlobalDCEPass(PM); -- return Val_unit; --} -diff --git a/llvm/bindings/ocaml/transforms/ipo/llvm_ipo.ml b/llvm/bindings/ocaml/transforms/ipo/llvm_ipo.ml -deleted file mode 100644 -index e54ee494e7be..000000000000 ---- a/llvm/bindings/ocaml/transforms/ipo/llvm_ipo.ml -+++ /dev/null -@@ -1,23 +0,0 @@ --(*===-- llvm_ipo.ml - LLVM OCaml Interface --------------------*- OCaml -*-===* -- * -- * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -- * See https://llvm.org/LICENSE.txt for license information. -- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -- * -- *===----------------------------------------------------------------------===*) -- --external add_constant_merge -- : [ `Module ] Llvm.PassManager.t -> unit -- = "llvm_add_constant_merge" --external add_dead_arg_elimination -- : [ `Module ] Llvm.PassManager.t -> unit -- = "llvm_add_dead_arg_elimination" --external add_function_attrs -- : [ `Module ] Llvm.PassManager.t -> unit -- = "llvm_add_function_attrs" --external add_always_inliner -- : [ `Module ] Llvm.PassManager.t -> unit -- = "llvm_add_always_inliner" --external add_global_dce -- : [ `Module ] Llvm.PassManager.t -> unit -- = "llvm_add_global_dce" -diff --git a/llvm/bindings/ocaml/transforms/ipo/llvm_ipo.mli b/llvm/bindings/ocaml/transforms/ipo/llvm_ipo.mli -deleted file mode 100644 -index baa098495e9c..000000000000 ---- a/llvm/bindings/ocaml/transforms/ipo/llvm_ipo.mli -+++ /dev/null -@@ -1,38 +0,0 @@ --(*===-- llvm_ipo.mli - LLVM OCaml Interface -------------------*- OCaml -*-===* -- * -- * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -- * See https://llvm.org/LICENSE.txt for license information. -- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -- * -- *===----------------------------------------------------------------------===*) -- --(** IPO Transforms. -- -- This interface provides an OCaml API for LLVM interprocedural optimizations, the -- classes in the [LLVMIPO] library. *) -- --(** See the [llvm::createConstantMergePass] function. *) --external add_constant_merge -- : [ `Module ] Llvm.PassManager.t -> unit -- = "llvm_add_constant_merge" -- --(** See the [llvm::createDeadArgEliminationPass] function. *) --external add_dead_arg_elimination -- : [ `Module ] Llvm.PassManager.t -> unit -- = "llvm_add_dead_arg_elimination" -- --(** See the [llvm::createFunctionAttrsPass] function. *) --external add_function_attrs -- : [ `Module ] Llvm.PassManager.t -> unit -- = "llvm_add_function_attrs" -- --(** See the [llvm::createAlwaysInlinerPass] function. *) --external add_always_inliner -- : [ `Module ] Llvm.PassManager.t -> unit -- = "llvm_add_always_inliner" -- --(** See the [llvm::createGlobalDCEPass] function. *) --external add_global_dce -- : [ `Module ] Llvm.PassManager.t -> unit -- = "llvm_add_global_dce" -- -\ No newline at end of file -diff --git a/llvm/bindings/ocaml/transforms/passmgr_builder/CMakeLists.txt b/llvm/bindings/ocaml/transforms/passmgr_builder/CMakeLists.txt -deleted file mode 100644 -index b012863d8ec7..000000000000 ---- a/llvm/bindings/ocaml/transforms/passmgr_builder/CMakeLists.txt -+++ /dev/null -@@ -1,5 +0,0 @@ --add_ocaml_library(llvm_passmgr_builder -- OCAML llvm_passmgr_builder -- OCAMLDEP llvm -- C passmgr_builder_ocaml -- LLVM ipo) -diff --git a/llvm/bindings/ocaml/transforms/passmgr_builder/llvm_passmgr_builder.ml b/llvm/bindings/ocaml/transforms/passmgr_builder/llvm_passmgr_builder.ml -deleted file mode 100644 -index c39a592c47d3..000000000000 ---- a/llvm/bindings/ocaml/transforms/passmgr_builder/llvm_passmgr_builder.ml -+++ /dev/null -@@ -1,28 +0,0 @@ --(*===-- llvm_passmgr_builder.ml - LLVM OCaml Interface --------*- OCaml -*-===* -- * -- * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -- * See https://llvm.org/LICENSE.txt for license information. -- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -- * -- *===----------------------------------------------------------------------===*) -- --type t -- --external create : unit -> t -- = "llvm_pmbuilder_create" --external set_opt_level : int -> t -> unit -- = "llvm_pmbuilder_set_opt_level" --external set_size_level : int -> t -> unit -- = "llvm_pmbuilder_set_size_level" --external set_disable_unit_at_a_time : bool -> t -> unit -- = "llvm_pmbuilder_set_disable_unit_at_a_time" --external set_disable_unroll_loops : bool -> t -> unit -- = "llvm_pmbuilder_set_disable_unroll_loops" --external use_inliner_with_threshold : int -> t -> unit -- = "llvm_pmbuilder_use_inliner_with_threshold" --external populate_function_pass_manager -- : [ `Function ] Llvm.PassManager.t -> t -> unit -- = "llvm_pmbuilder_populate_function_pass_manager" --external populate_module_pass_manager -- : [ `Module ] Llvm.PassManager.t -> t -> unit -- = "llvm_pmbuilder_populate_module_pass_manager" -\ No newline at end of file -diff --git a/llvm/bindings/ocaml/transforms/passmgr_builder/llvm_passmgr_builder.mli b/llvm/bindings/ocaml/transforms/passmgr_builder/llvm_passmgr_builder.mli -deleted file mode 100644 -index d2861ea343b6..000000000000 ---- a/llvm/bindings/ocaml/transforms/passmgr_builder/llvm_passmgr_builder.mli -+++ /dev/null -@@ -1,48 +0,0 @@ --(*===-- llvm_passmgr_builder.mli - LLVM OCaml Interface -------*- OCaml -*-===* -- * -- * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -- * See https://llvm.org/LICENSE.txt for license information. -- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -- * -- *===----------------------------------------------------------------------===*) -- --(** Pass Manager Builder. -- -- This interface provides an OCaml API for LLVM pass manager builder -- from the [LLVMCore] library. *) -- --type t -- --(** See the [llvm::PassManagerBuilder] function. *) --external create : unit -> t -- = "llvm_pmbuilder_create" -- --(** See the [llvm::PassManagerBuilder::OptLevel] function. *) --external set_opt_level : int -> t -> unit -- = "llvm_pmbuilder_set_opt_level" -- --(** See the [llvm::PassManagerBuilder::SizeLevel] function. *) --external set_size_level : int -> t -> unit -- = "llvm_pmbuilder_set_size_level" -- --(** See the [llvm::PassManagerBuilder::DisableUnitAtATime] function. *) --external set_disable_unit_at_a_time : bool -> t -> unit -- = "llvm_pmbuilder_set_disable_unit_at_a_time" -- --(** See the [llvm::PassManagerBuilder::DisableUnrollLoops] function. *) --external set_disable_unroll_loops : bool -> t -> unit -- = "llvm_pmbuilder_set_disable_unroll_loops" -- --(** See the [llvm::PassManagerBuilder::Inliner] function. *) --external use_inliner_with_threshold : int -> t -> unit -- = "llvm_pmbuilder_use_inliner_with_threshold" -- --(** See the [llvm::PassManagerBuilder::populateFunctionPassManager] function. *) --external populate_function_pass_manager -- : [ `Function ] Llvm.PassManager.t -> t -> unit -- = "llvm_pmbuilder_populate_function_pass_manager" -- --(** See the [llvm::PassManagerBuilder::populateModulePassManager] function. *) --external populate_module_pass_manager -- : [ `Module ] Llvm.PassManager.t -> t -> unit -- = "llvm_pmbuilder_populate_module_pass_manager" -diff --git a/llvm/bindings/ocaml/transforms/passmgr_builder/passmgr_builder_ocaml.c b/llvm/bindings/ocaml/transforms/passmgr_builder/passmgr_builder_ocaml.c -deleted file mode 100644 -index de0a76219d37..000000000000 ---- a/llvm/bindings/ocaml/transforms/passmgr_builder/passmgr_builder_ocaml.c -+++ /dev/null -@@ -1,92 +0,0 @@ --/*===-- passmgr_builder_ocaml.c - LLVM OCaml Glue ---------------*- C++ -*-===*\ --|* *| --|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| --|* Exceptions. *| --|* See https://llvm.org/LICENSE.txt for license information. *| --|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| --|* *| --|*===----------------------------------------------------------------------===*| --|* *| --|* This file glues LLVM's OCaml interface to its C interface. These functions *| --|* are by and large transparent wrappers to the corresponding C functions. *| --|* *| --|* Note that these functions intentionally take liberties with the CAMLparamX *| --|* macros, since most of the parameters are not GC heap objects. *| --|* *| --\*===----------------------------------------------------------------------===*/ -- --#include "llvm-c/Transforms/PassManagerBuilder.h" --#include "caml/mlvalues.h" --#include "caml/custom.h" --#include "caml/misc.h" -- --#define PMBuilder_val(v) (*(LLVMPassManagerBuilderRef *)(Data_custom_val(v))) -- --static void llvm_finalize_pmbuilder(value PMB) { -- LLVMPassManagerBuilderDispose(PMBuilder_val(PMB)); --} -- --static struct custom_operations pmbuilder_ops = { -- (char *)"Llvm_passmgr_builder.t", llvm_finalize_pmbuilder, -- custom_compare_default, custom_hash_default, -- custom_serialize_default, custom_deserialize_default, -- custom_compare_ext_default}; -- --static value alloc_pmbuilder(LLVMPassManagerBuilderRef Ref) { -- value Val = -- alloc_custom(&pmbuilder_ops, sizeof(LLVMPassManagerBuilderRef), 0, 1); -- PMBuilder_val(Val) = Ref; -- return Val; --} -- --/* t -> unit */ --value llvm_pmbuilder_create(value Unit) { -- return alloc_pmbuilder(LLVMPassManagerBuilderCreate()); --} -- --/* int -> t -> unit */ --value llvm_pmbuilder_set_opt_level(value OptLevel, value PMB) { -- LLVMPassManagerBuilderSetOptLevel(PMBuilder_val(PMB), Int_val(OptLevel)); -- return Val_unit; --} -- --/* int -> t -> unit */ --value llvm_pmbuilder_set_size_level(value SizeLevel, value PMB) { -- LLVMPassManagerBuilderSetSizeLevel(PMBuilder_val(PMB), Int_val(SizeLevel)); -- return Val_unit; --} -- --/* int -> t -> unit */ --value llvm_pmbuilder_use_inliner_with_threshold(value Threshold, value PMB) { -- LLVMPassManagerBuilderSetOptLevel(PMBuilder_val(PMB), Int_val(Threshold)); -- return Val_unit; --} -- --/* bool -> t -> unit */ --value llvm_pmbuilder_set_disable_unit_at_a_time(value DisableUnitAtATime, -- value PMB) { -- LLVMPassManagerBuilderSetDisableUnitAtATime(PMBuilder_val(PMB), -- Bool_val(DisableUnitAtATime)); -- return Val_unit; --} -- --/* bool -> t -> unit */ --value llvm_pmbuilder_set_disable_unroll_loops(value DisableUnroll, value PMB) { -- LLVMPassManagerBuilderSetDisableUnrollLoops(PMBuilder_val(PMB), -- Bool_val(DisableUnroll)); -- return Val_unit; --} -- --/* [ `Function ] Llvm.PassManager.t -> t -> unit */ --value llvm_pmbuilder_populate_function_pass_manager(LLVMPassManagerRef PM, -- value PMB) { -- LLVMPassManagerBuilderPopulateFunctionPassManager(PMBuilder_val(PMB), PM); -- return Val_unit; --} -- --/* [ `Module ] Llvm.PassManager.t -> t -> unit */ --value llvm_pmbuilder_populate_module_pass_manager(LLVMPassManagerRef PM, -- value PMB) { -- LLVMPassManagerBuilderPopulateModulePassManager(PMBuilder_val(PMB), PM); -- return Val_unit; --} -diff --git a/llvm/bindings/ocaml/transforms/scalar_opts/CMakeLists.txt b/llvm/bindings/ocaml/transforms/scalar_opts/CMakeLists.txt -deleted file mode 100644 -index d680b02046c6..000000000000 ---- a/llvm/bindings/ocaml/transforms/scalar_opts/CMakeLists.txt -+++ /dev/null -@@ -1,5 +0,0 @@ --add_ocaml_library(llvm_scalar_opts -- OCAML llvm_scalar_opts -- OCAMLDEP llvm -- C scalar_opts_ocaml -- LLVM Scalar) -diff --git a/llvm/bindings/ocaml/transforms/scalar_opts/llvm_scalar_opts.ml b/llvm/bindings/ocaml/transforms/scalar_opts/llvm_scalar_opts.ml -deleted file mode 100644 -index cf212b90f717..000000000000 ---- a/llvm/bindings/ocaml/transforms/scalar_opts/llvm_scalar_opts.ml -+++ /dev/null -@@ -1,116 +0,0 @@ --(*===-- llvm_scalar_opts.ml - LLVM OCaml Interface ------------*- OCaml -*-===* -- * -- * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -- * See https://llvm.org/LICENSE.txt for license information. -- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -- * -- *===----------------------------------------------------------------------===*) -- --external add_aggressive_dce -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_aggressive_dce" --external add_dce -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_dce" --external add_alignment_from_assumptions -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_alignment_from_assumptions" --external add_cfg_simplification -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_cfg_simplification" --external add_dead_store_elimination -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_dead_store_elimination" --external add_scalarizer -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_scalarizer" --external add_merged_load_store_motion -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_merged_load_store_motion" --external add_gvn -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_gvn" --external add_ind_var_simplification -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_ind_var_simplify" --external add_instruction_combination -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_instruction_combining" --external add_jump_threading -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_jump_threading" --external add_licm -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_licm" --external add_loop_rotation -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_loop_rotate" --external add_loop_unroll -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_loop_unroll" --external add_memcpy_opt -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_memcpy_opt" --external add_partially_inline_lib_calls -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_partially_inline_lib_calls" --external add_lower_atomic -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_lower_atomic" --external add_lower_switch -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_lower_switch" --external add_memory_to_register_promotion -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_promote_memory_to_register" --external add_reassociation -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_reassociation" --external add_sccp -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_sccp" --external add_scalar_repl_aggregation -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_scalar_repl_aggregates" --external add_scalar_repl_aggregation_ssa -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_scalar_repl_aggregates_ssa" --external add_scalar_repl_aggregation_with_threshold -- : int -> [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_scalar_repl_aggregates_with_threshold" --external add_lib_call_simplification -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_simplify_lib_calls" --external add_tail_call_elimination -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_tail_call_elimination" --external add_memory_to_register_demotion -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_demote_memory_to_register" --external add_verifier -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_verifier" --external add_correlated_value_propagation -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_correlated_value_propagation" --external add_early_cse -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_early_cse" --external add_lower_expect_intrinsic -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_lower_expect_intrinsic" --external add_lower_constant_intrinsics -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_lower_constant_intrinsics" --external add_type_based_alias_analysis -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_type_based_alias_analysis" --external add_scoped_no_alias_alias_analysis -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_scoped_no_alias_aa" --external add_basic_alias_analysis -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_basic_alias_analysis" --external add_unify_function_exit_nodes -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_unify_function_exit_nodes" -diff --git a/llvm/bindings/ocaml/transforms/scalar_opts/llvm_scalar_opts.mli b/llvm/bindings/ocaml/transforms/scalar_opts/llvm_scalar_opts.mli -deleted file mode 100644 -index ff21c357f74c..000000000000 ---- a/llvm/bindings/ocaml/transforms/scalar_opts/llvm_scalar_opts.mli -+++ /dev/null -@@ -1,187 +0,0 @@ --(*===-- llvm_scalar_opts.mli - LLVM OCaml Interface -----------*- OCaml -*-===* -- * -- * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -- * See https://llvm.org/LICENSE.txt for license information. -- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -- * -- *===----------------------------------------------------------------------===*) -- --(** Scalar Transforms. -- -- This interface provides an OCaml API for LLVM scalar transforms, the -- classes in the [LLVMScalarOpts] library. *) -- --(** See the [llvm::createAggressiveDCEPass] function. *) --external add_aggressive_dce -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_aggressive_dce" -- --(** See the [llvm::createDCEPass] function. *) --external add_dce -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_dce" -- --(** See the [llvm::createAlignmentFromAssumptionsPass] function. *) --external add_alignment_from_assumptions -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_alignment_from_assumptions" -- --(** See the [llvm::createCFGSimplificationPass] function. *) --external add_cfg_simplification -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_cfg_simplification" -- --(** See [llvm::createDeadStoreEliminationPass] function. *) --external add_dead_store_elimination -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_dead_store_elimination" -- --(** See [llvm::createScalarizerPass] function. *) --external add_scalarizer -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_scalarizer" -- --(** See [llvm::createMergedLoadStoreMotionPass] function. *) --external add_merged_load_store_motion -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_merged_load_store_motion" -- --(** See the [llvm::createGVNPass] function. *) --external add_gvn -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_gvn" -- --(** See the [llvm::createIndVarSimplifyPass] function. *) --external add_ind_var_simplification -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_ind_var_simplify" -- --(** See the [llvm::createInstructionCombiningPass] function. *) --external add_instruction_combination -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_instruction_combining" -- --(** See the [llvm::createJumpThreadingPass] function. *) --external add_jump_threading -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_jump_threading" -- --(** See the [llvm::createLICMPass] function. *) --external add_licm -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_licm" -- --(** See the [llvm::createLoopRotatePass] function. *) --external add_loop_rotation -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_loop_rotate" -- --(** See the [llvm::createLoopUnrollPass] function. *) --external add_loop_unroll -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_loop_unroll" -- --(** See the [llvm::createMemCpyOptPass] function. *) --external add_memcpy_opt -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_memcpy_opt" -- --(** See the [llvm::createPartiallyInlineLibCallsPass] function. *) --external add_partially_inline_lib_calls -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_partially_inline_lib_calls" -- --(** See the [llvm::createLowerAtomicPass] function. *) --external add_lower_atomic -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_lower_atomic" -- --(** See the [llvm::createLowerSwitchPass] function. *) --external add_lower_switch -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_lower_switch" -- --(** See the [llvm::createPromoteMemoryToRegisterPass] function. *) --external add_memory_to_register_promotion -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_promote_memory_to_register" -- --(** See the [llvm::createReassociatePass] function. *) --external add_reassociation -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_reassociation" -- --(** See the [llvm::createSROAPass] function. *) --external add_scalar_repl_aggregation -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_scalar_repl_aggregates" -- --(** See the [llvm::createSROAPass] function. *) --external add_scalar_repl_aggregation_ssa -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_scalar_repl_aggregates_ssa" -- --(** See the [llvm::createSROAPass] function. *) --external add_scalar_repl_aggregation_with_threshold -- : int -> [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_scalar_repl_aggregates_with_threshold" -- --(** See the [llvm::createSimplifyLibCallsPass] function. *) --external add_lib_call_simplification -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_simplify_lib_calls" -- --(** See the [llvm::createTailCallEliminationPass] function. *) --external add_tail_call_elimination -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_tail_call_elimination" -- --(** See the [llvm::createDemoteMemoryToRegisterPass] function. *) --external add_memory_to_register_demotion -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_demote_memory_to_register" -- --(** See the [llvm::createVerifierPass] function. *) --external add_verifier -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_verifier" -- --(** See the [llvm::createCorrelatedValuePropagationPass] function. *) --external add_correlated_value_propagation -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_correlated_value_propagation" -- --(** See the [llvm::createEarlyCSE] function. *) --external add_early_cse -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_early_cse" -- --(** See the [llvm::createLowerExpectIntrinsicPass] function. *) --external add_lower_expect_intrinsic -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_lower_expect_intrinsic" -- --(** See the [llvm::createLowerConstantIntrinsicsPass] function. *) --external add_lower_constant_intrinsics -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_lower_constant_intrinsics" -- --(** See the [llvm::createTypeBasedAliasAnalysisPass] function. *) --external add_type_based_alias_analysis -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_type_based_alias_analysis" -- --(** See the [llvm::createScopedNoAliasAAPass] function. *) --external add_scoped_no_alias_alias_analysis -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_scoped_no_alias_aa" -- --(** See the [llvm::createBasicAliasAnalysisPass] function. *) --external add_basic_alias_analysis -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_basic_alias_analysis" -- --(** See the [llvm::createUnifyFunctionExitNodesPass] function. *) --external add_unify_function_exit_nodes -- : [< Llvm.PassManager.any ] Llvm.PassManager.t -> unit -- = "llvm_add_unify_function_exit_nodes" -diff --git a/llvm/bindings/ocaml/transforms/scalar_opts/scalar_opts_ocaml.c b/llvm/bindings/ocaml/transforms/scalar_opts/scalar_opts_ocaml.c -deleted file mode 100644 -index a8041695f0ed..000000000000 ---- a/llvm/bindings/ocaml/transforms/scalar_opts/scalar_opts_ocaml.c -+++ /dev/null -@@ -1,231 +0,0 @@ --/*===-- scalar_opts_ocaml.c - LLVM OCaml Glue -------------------*- C++ -*-===*\ --|* *| --|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| --|* Exceptions. *| --|* See https://llvm.org/LICENSE.txt for license information. *| --|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| --|* *| --|*===----------------------------------------------------------------------===*| --|* *| --|* This file glues LLVM's OCaml interface to its C interface. These functions *| --|* are by and large transparent wrappers to the corresponding C functions. *| --|* *| --|* Note that these functions intentionally take liberties with the CAMLparamX *| --|* macros, since most of the parameters are not GC heap objects. *| --|* *| --\*===----------------------------------------------------------------------===*/ -- --#include "llvm-c/Transforms/Scalar.h" --#include "llvm-c/Transforms/Utils.h" --#include "caml/mlvalues.h" --#include "caml/misc.h" -- --/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ --value llvm_add_aggressive_dce(LLVMPassManagerRef PM) { -- LLVMAddAggressiveDCEPass(PM); -- return Val_unit; --} -- --value llvm_add_dce(LLVMPassManagerRef PM) { -- LLVMAddDCEPass(PM); -- return Val_unit; --} -- --/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ --value llvm_add_alignment_from_assumptions(LLVMPassManagerRef PM) { -- LLVMAddAlignmentFromAssumptionsPass(PM); -- return Val_unit; --} -- --/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ --value llvm_add_cfg_simplification(LLVMPassManagerRef PM) { -- LLVMAddCFGSimplificationPass(PM); -- return Val_unit; --} -- --/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ --value llvm_add_dead_store_elimination(LLVMPassManagerRef PM) { -- LLVMAddDeadStoreEliminationPass(PM); -- return Val_unit; --} -- --/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ --value llvm_add_scalarizer(LLVMPassManagerRef PM) { -- LLVMAddScalarizerPass(PM); -- return Val_unit; --} -- --/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ --value llvm_add_merged_load_store_motion(LLVMPassManagerRef PM) { -- LLVMAddMergedLoadStoreMotionPass(PM); -- return Val_unit; --} -- --/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ --value llvm_add_gvn(LLVMPassManagerRef PM) { -- LLVMAddGVNPass(PM); -- return Val_unit; --} -- --/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ --value llvm_add_ind_var_simplify(LLVMPassManagerRef PM) { -- LLVMAddIndVarSimplifyPass(PM); -- return Val_unit; --} -- --/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ --value llvm_add_instruction_combining(LLVMPassManagerRef PM) { -- LLVMAddInstructionCombiningPass(PM); -- return Val_unit; --} -- --/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ --value llvm_add_jump_threading(LLVMPassManagerRef PM) { -- LLVMAddJumpThreadingPass(PM); -- return Val_unit; --} -- --/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ --value llvm_add_licm(LLVMPassManagerRef PM) { -- LLVMAddLICMPass(PM); -- return Val_unit; --} -- --/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ --value llvm_add_loop_rotate(LLVMPassManagerRef PM) { -- LLVMAddLoopRotatePass(PM); -- return Val_unit; --} -- --/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ --value llvm_add_loop_unroll(LLVMPassManagerRef PM) { -- LLVMAddLoopUnrollPass(PM); -- return Val_unit; --} -- --/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ --value llvm_add_memcpy_opt(LLVMPassManagerRef PM) { -- LLVMAddMemCpyOptPass(PM); -- return Val_unit; --} -- --/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ --value llvm_add_partially_inline_lib_calls(LLVMPassManagerRef PM) { -- LLVMAddPartiallyInlineLibCallsPass(PM); -- return Val_unit; --} -- --/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ --value llvm_add_lower_atomic(LLVMPassManagerRef PM) { -- LLVMAddLowerAtomicPass(PM); -- return Val_unit; --} -- --/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ --value llvm_add_lower_switch(LLVMPassManagerRef PM) { -- LLVMAddLowerSwitchPass(PM); -- return Val_unit; --} -- --/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ --value llvm_add_promote_memory_to_register(LLVMPassManagerRef PM) { -- LLVMAddPromoteMemoryToRegisterPass(PM); -- return Val_unit; --} -- --/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ --value llvm_add_reassociation(LLVMPassManagerRef PM) { -- LLVMAddReassociatePass(PM); -- return Val_unit; --} -- --/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ --value llvm_add_scalar_repl_aggregates(LLVMPassManagerRef PM) { -- LLVMAddScalarReplAggregatesPass(PM); -- return Val_unit; --} -- --/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ --value llvm_add_scalar_repl_aggregates_ssa(LLVMPassManagerRef PM) { -- LLVMAddScalarReplAggregatesPassSSA(PM); -- return Val_unit; --} -- --/* int -> [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ --value llvm_add_scalar_repl_aggregates_with_threshold(value threshold, -- LLVMPassManagerRef PM) { -- LLVMAddScalarReplAggregatesPassWithThreshold(PM, Int_val(threshold)); -- return Val_unit; --} -- --/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ --value llvm_add_simplify_lib_calls(LLVMPassManagerRef PM) { -- LLVMAddSimplifyLibCallsPass(PM); -- return Val_unit; --} -- --/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ --value llvm_add_tail_call_elimination(LLVMPassManagerRef PM) { -- LLVMAddTailCallEliminationPass(PM); -- return Val_unit; --} -- --/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ --value llvm_add_demote_memory_to_register(LLVMPassManagerRef PM) { -- LLVMAddDemoteMemoryToRegisterPass(PM); -- return Val_unit; --} -- --/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ --value llvm_add_verifier(LLVMPassManagerRef PM) { -- LLVMAddVerifierPass(PM); -- return Val_unit; --} -- --/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ --value llvm_add_correlated_value_propagation(LLVMPassManagerRef PM) { -- LLVMAddCorrelatedValuePropagationPass(PM); -- return Val_unit; --} -- --/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ --value llvm_add_early_cse(LLVMPassManagerRef PM) { -- LLVMAddEarlyCSEPass(PM); -- return Val_unit; --} -- --/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ --value llvm_add_lower_expect_intrinsic(LLVMPassManagerRef PM) { -- LLVMAddLowerExpectIntrinsicPass(PM); -- return Val_unit; --} -- --/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ --value llvm_add_lower_constant_intrinsics(LLVMPassManagerRef PM) { -- LLVMAddLowerConstantIntrinsicsPass(PM); -- return Val_unit; --} -- --/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ --value llvm_add_type_based_alias_analysis(LLVMPassManagerRef PM) { -- LLVMAddTypeBasedAliasAnalysisPass(PM); -- return Val_unit; --} -- --/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ --value llvm_add_scoped_no_alias_aa(LLVMPassManagerRef PM) { -- LLVMAddScopedNoAliasAAPass(PM); -- return Val_unit; --} -- --/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ --value llvm_add_basic_alias_analysis(LLVMPassManagerRef PM) { -- LLVMAddBasicAliasAnalysisPass(PM); -- return Val_unit; --} -- --/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ --value llvm_add_unify_function_exit_nodes(LLVMPassManagerRef PM) { -- LLVMAddUnifyFunctionExitNodesPass(PM); -- return Val_unit; --} -diff --git a/llvm/bindings/ocaml/transforms/vectorize/CMakeLists.txt b/llvm/bindings/ocaml/transforms/vectorize/CMakeLists.txt -deleted file mode 100644 -index 47af23928ccb..000000000000 ---- a/llvm/bindings/ocaml/transforms/vectorize/CMakeLists.txt -+++ /dev/null -@@ -1,5 +0,0 @@ --add_ocaml_library(llvm_vectorize -- OCAML llvm_vectorize -- OCAMLDEP llvm -- C vectorize_ocaml -- LLVM Vectorize) -diff --git a/llvm/bindings/ocaml/transforms/vectorize/llvm_vectorize.ml b/llvm/bindings/ocaml/transforms/vectorize/llvm_vectorize.ml -deleted file mode 100644 -index a2e280e15848..000000000000 ---- a/llvm/bindings/ocaml/transforms/vectorize/llvm_vectorize.ml -+++ /dev/null -@@ -1,14 +0,0 @@ --(*===-- llvm_vectorize.ml - LLVM OCaml Interface --------------*- OCaml -*-===* -- * -- * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -- * See https://llvm.org/LICENSE.txt for license information. -- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -- * -- *===----------------------------------------------------------------------===*) -- --external add_loop_vectorize -- : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit -- = "llvm_add_loop_vectorize" --external add_slp_vectorize -- : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit -- = "llvm_add_slp_vectorize" -diff --git a/llvm/bindings/ocaml/transforms/vectorize/llvm_vectorize.mli b/llvm/bindings/ocaml/transforms/vectorize/llvm_vectorize.mli -deleted file mode 100644 -index 7376d9e6d814..000000000000 ---- a/llvm/bindings/ocaml/transforms/vectorize/llvm_vectorize.mli -+++ /dev/null -@@ -1,22 +0,0 @@ --(*===-- llvm_vectorize.mli - LLVM OCaml Interface -------------*- OCaml -*-===* -- * -- * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -- * See https://llvm.org/LICENSE.txt for license information. -- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -- * -- *===----------------------------------------------------------------------===*) -- --(** Vectorize Transforms. -- -- This interface provides an OCaml API for LLVM vectorize transforms, the -- classes in the [LLVMVectorize] library. *) -- --(** See the [llvm::createLoopVectorizePass] function. *) --external add_loop_vectorize -- : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit -- = "llvm_add_loop_vectorize" -- --(** See the [llvm::createSLPVectorizerPass] function. *) --external add_slp_vectorize -- : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit -- = "llvm_add_slp_vectorize" -diff --git a/llvm/bindings/ocaml/transforms/vectorize/vectorize_ocaml.c b/llvm/bindings/ocaml/transforms/vectorize/vectorize_ocaml.c -deleted file mode 100644 -index d9b15bf4588e..000000000000 ---- a/llvm/bindings/ocaml/transforms/vectorize/vectorize_ocaml.c -+++ /dev/null -@@ -1,32 +0,0 @@ --/*===-- vectorize_ocaml.c - LLVM OCaml Glue ---------------------*- C++ -*-===*\ --|* *| --|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| --|* Exceptions. *| --|* See https://llvm.org/LICENSE.txt for license information. *| --|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| --|* *| --|*===----------------------------------------------------------------------===*| --|* *| --|* This file glues LLVM's OCaml interface to its C interface. These functions *| --|* are by and large transparent wrappers to the corresponding C functions. *| --|* *| --|* Note that these functions intentionally take liberties with the CAMLparamX *| --|* macros, since most of the parameters are not GC heap objects. *| --|* *| --\*===----------------------------------------------------------------------===*/ -- --#include "llvm-c/Transforms/Vectorize.h" --#include "caml/mlvalues.h" --#include "caml/misc.h" -- --/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ --value llvm_add_loop_vectorize(LLVMPassManagerRef PM) { -- LLVMAddLoopVectorizePass(PM); -- return Val_unit; --} -- --/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */ --value llvm_add_slp_vectorize(LLVMPassManagerRef PM) { -- LLVMAddSLPVectorizePass(PM); -- return Val_unit; --} -diff --git a/llvm/docs/CMakeLists.txt b/llvm/docs/CMakeLists.txt -index 0f2681e0cd86..5e420a269632 100644 ---- a/llvm/docs/CMakeLists.txt -+++ b/llvm/docs/CMakeLists.txt -@@ -131,11 +131,7 @@ if( NOT uses_ocaml LESS 0 AND LLVM_ENABLE_OCAMLDOC ) - ocaml_llvm_irreader - ocaml_llvm_linker - ocaml_llvm_target -- ocaml_llvm_ipo -- ocaml_llvm_passmgr_builder -- ocaml_llvm_scalar_opts - ocaml_llvm_transform_utils -- ocaml_llvm_vectorize - ) - - foreach(llvm_target ${LLVM_TARGETS_TO_BUILD}) -diff --git a/llvm/test/Bindings/OCaml/core.ml b/llvm/test/Bindings/OCaml/core.ml -index f8ed68585d8a..86a5a115172c 100644 ---- a/llvm/test/Bindings/OCaml/core.ml -+++ b/llvm/test/Bindings/OCaml/core.ml -@@ -1458,29 +1458,6 @@ let test_builder () = - * CHECK: !1 = !{i32 1, !"metadata test"} - *) - --(*===-- Pass Managers -----------------------------------------------------===*) -- --let test_pass_manager () = -- let (++) x f = ignore (f x); x in -- -- begin group "module pass manager"; -- ignore (PassManager.create () -- ++ PassManager.run_module m -- ++ PassManager.dispose) -- end; -- -- begin group "function pass manager"; -- let fty = function_type void_type [| |] in -- let fn = define_function "FunctionPassManager" fty m in -- ignore (build_ret_void (builder_at_end context (entry_block fn))); -- -- ignore (PassManager.create_function m -- ++ PassManager.initialize -- ++ PassManager.run_function fn -- ++ PassManager.finalize -- ++ PassManager.dispose) -- end -- - - (*===-- Memory Buffer -----------------------------------------------------===*) - -@@ -1523,7 +1500,6 @@ let _ = - suite "basic blocks" test_basic_blocks; - suite "instructions" test_instructions; - suite "builder" test_builder; -- suite "pass manager" test_pass_manager; - suite "memory buffer" test_memory_buffer; - suite "writer" test_writer; (* Keep this last; it disposes m. *) - exit !exit_status -diff --git a/llvm/test/Bindings/OCaml/ipo.ml b/llvm/test/Bindings/OCaml/ipo.ml -deleted file mode 100644 -index 9866de4e8ec1..000000000000 ---- a/llvm/test/Bindings/OCaml/ipo.ml -+++ /dev/null -@@ -1,63 +0,0 @@ --(* RUN: rm -rf %t && mkdir -p %t && cp %s %t/ipo_opts.ml -- * RUN: %ocamlc -g -w +A -package llvm.ipo -linkpkg %t/ipo_opts.ml -o %t/executable -- * RUN: %t/executable %t/bitcode.bc -- * RUN: %ocamlopt -g -w +A -package llvm.ipo -linkpkg %t/ipo_opts.ml -o %t/executable -- * RUN: %t/executable %t/bitcode.bc -- * XFAIL: vg_leak -- *) -- --(* Note: It takes several seconds for ocamlopt to link an executable with -- libLLVMCore.a, so it's better to write a big test than a bunch of -- little ones. *) -- --open Llvm --open Llvm_ipo --open Llvm_target -- --let context = global_context () --let void_type = Llvm.void_type context --let i8_type = Llvm.i8_type context -- --(* Tiny unit test framework - really just to help find which line is busted *) --let print_checkpoints = false -- --let suite name f = -- if print_checkpoints then -- prerr_endline (name ^ ":"); -- f () -- -- --(*===-- Fixture -----------------------------------------------------------===*) -- --let filename = Sys.argv.(1) --let m = create_module context filename -- -- --(*===-- Transforms --------------------------------------------------------===*) -- --let test_transforms () = -- let (++) x f = f x; x in -- -- let fty = function_type i8_type [| |] in -- let fn = define_function "fn" fty m in -- let fn2 = define_function "fn2" fty m in begin -- ignore (build_ret (const_int i8_type 4) (builder_at_end context (entry_block fn))); -- let b = builder_at_end context (entry_block fn2) in -- ignore (build_ret (build_call fty fn [| |] "" b) b); -- end; -- -- ignore (PassManager.create () -- ++ add_constant_merge -- ++ add_dead_arg_elimination -- ++ add_function_attrs -- ++ add_always_inliner -- ++ add_global_dce -- ++ PassManager.run_module m -- ++ PassManager.dispose) -- -- --(*===-- Driver ------------------------------------------------------------===*) -- --let _ = -- suite "transforms" test_transforms; -- dispose_module m -diff --git a/llvm/test/Bindings/OCaml/passmgr_builder.ml b/llvm/test/Bindings/OCaml/passmgr_builder.ml -deleted file mode 100644 -index f761b2a31456..000000000000 ---- a/llvm/test/Bindings/OCaml/passmgr_builder.ml -+++ /dev/null -@@ -1,60 +0,0 @@ --(* RUN: rm -rf %t && mkdir -p %t && cp %s %t/passmgr_builder.ml -- * RUN: %ocamlc -g -w +A -package llvm.passmgr_builder -linkpkg %t/passmgr_builder.ml -o %t/executable -- * RUN: %t/executable %t/bitcode.bc -- * RUN: %ocamlopt -g -w +A -package llvm.passmgr_builder -linkpkg %t/passmgr_builder.ml -o %t/executable -- * RUN: %t/executable %t/bitcode.bc -- * XFAIL: vg_leak -- *) -- --(* Note: It takes several seconds for ocamlopt to link an executable with -- libLLVMCore.a, so it's better to write a big test than a bunch of -- little ones. *) -- --open Llvm --open Llvm_passmgr_builder -- --let context = global_context () --let void_type = Llvm.void_type context -- --(* Tiny unit test framework - really just to help find which line is busted *) --let print_checkpoints = false -- --let suite name f = -- if print_checkpoints then -- prerr_endline (name ^ ":"); -- f () -- -- --(*===-- Fixture -----------------------------------------------------------===*) -- --let filename = Sys.argv.(1) --let m = create_module context filename -- -- --(*===-- Pass Manager Builder ----------------------------------------------===*) -- --let test_pmbuilder () = -- let (++) x f = ignore (f x); x in -- -- let module_passmgr = PassManager.create () in -- let func_passmgr = PassManager.create_function m in -- -- ignore (Llvm_passmgr_builder.create () -- ++ set_opt_level 3 -- ++ set_size_level 1 -- ++ set_disable_unit_at_a_time false -- ++ set_disable_unroll_loops false -- ++ use_inliner_with_threshold 10 -- ++ populate_function_pass_manager func_passmgr -- ++ populate_module_pass_manager module_passmgr); -- Gc.compact (); -- -- PassManager.dispose module_passmgr; -- PassManager.dispose func_passmgr -- -- --(*===-- Driver ------------------------------------------------------------===*) -- --let _ = -- suite "pass manager builder" test_pmbuilder; -- dispose_module m -diff --git a/llvm/test/Bindings/OCaml/scalar_opts.ml b/llvm/test/Bindings/OCaml/scalar_opts.ml -deleted file mode 100644 -index 861e38c4bf01..000000000000 ---- a/llvm/test/Bindings/OCaml/scalar_opts.ml -+++ /dev/null -@@ -1,87 +0,0 @@ --(* RUN: rm -rf %t && mkdir -p %t && cp %s %t/scalar_opts.ml -- * RUN: %ocamlc -g -w +A -package llvm.scalar_opts -linkpkg %t/scalar_opts.ml -o %t/executable -- * RUN: %t/executable %t/bitcode.bc -- * RUN: %ocamlopt -g -w +A -package llvm.scalar_opts -linkpkg %t/scalar_opts.ml -o %t/executable -- * RUN: %t/executable %t/bitcode.bc -- * XFAIL: vg_leak -- *) -- --(* Note: It takes several seconds for ocamlopt to link an executable with -- libLLVMCore.a, so it's better to write a big test than a bunch of -- little ones. *) -- --open Llvm --open Llvm_scalar_opts --open Llvm_target -- --let context = global_context () --let void_type = Llvm.void_type context -- --(* Tiny unit test framework - really just to help find which line is busted *) --let print_checkpoints = false -- --let suite name f = -- if print_checkpoints then -- prerr_endline (name ^ ":"); -- f () -- -- --(*===-- Fixture -----------------------------------------------------------===*) -- --let filename = Sys.argv.(1) --let m = create_module context filename -- -- --(*===-- Transforms --------------------------------------------------------===*) -- --let test_transforms () = -- let (++) x f = f x; x in -- -- let fty = function_type void_type [| |] in -- let fn = define_function "fn" fty m in -- ignore (build_ret_void (builder_at_end context (entry_block fn))); -- -- ignore (PassManager.create_function m -- ++ add_aggressive_dce -- ++ add_alignment_from_assumptions -- ++ add_cfg_simplification -- ++ add_dead_store_elimination -- ++ add_scalarizer -- ++ add_merged_load_store_motion -- ++ add_gvn -- ++ add_ind_var_simplification -- ++ add_instruction_combination -- ++ add_jump_threading -- ++ add_licm -- ++ add_loop_rotation -- ++ add_loop_unroll -- ++ add_memcpy_opt -- ++ add_partially_inline_lib_calls -- ++ add_lower_switch -- ++ add_memory_to_register_promotion -- ++ add_reassociation -- ++ add_sccp -- ++ add_scalar_repl_aggregation -- ++ add_scalar_repl_aggregation_ssa -- ++ add_scalar_repl_aggregation_with_threshold 4 -- ++ add_lib_call_simplification -- ++ add_tail_call_elimination -- ++ add_memory_to_register_demotion -- ++ add_verifier -- ++ add_correlated_value_propagation -- ++ add_early_cse -- ++ add_lower_expect_intrinsic -- ++ add_type_based_alias_analysis -- ++ add_scoped_no_alias_alias_analysis -- ++ add_basic_alias_analysis -- ++ PassManager.initialize -- ++ PassManager.run_function fn -- ++ PassManager.finalize -- ++ PassManager.dispose) -- -- --(*===-- Driver ------------------------------------------------------------===*) -- --let _ = -- suite "transforms" test_transforms; -- dispose_module m -diff --git a/llvm/test/Bindings/OCaml/target.ml b/llvm/test/Bindings/OCaml/target.ml -index 900668147b74..e9465fd0eb29 100644 ---- a/llvm/test/Bindings/OCaml/target.ml -+++ b/llvm/test/Bindings/OCaml/target.ml -@@ -82,9 +82,7 @@ let test_target_machine () = - assert_equal (TM.cpu machine) ""; - assert_equal (TM.features machine) ""; - ignore (TM.data_layout machine); -- TM.set_verbose_asm true machine; -- let pm = PassManager.create () in -- TM.add_analysis_passes pm machine -+ TM.set_verbose_asm true machine - - - (*===-- Code Emission -----------------------------------------------------===*) -diff --git a/llvm/test/Bindings/OCaml/vectorize.ml b/llvm/test/Bindings/OCaml/vectorize.ml -deleted file mode 100644 -index 72cd191b3626..000000000000 ---- a/llvm/test/Bindings/OCaml/vectorize.ml -+++ /dev/null -@@ -1,55 +0,0 @@ --(* RUN: rm -rf %t && mkdir -p %t && cp %s %t/vectorize_opts.ml -- * RUN: %ocamlc -g -w +A -package llvm.vectorize -linkpkg %t/vectorize_opts.ml -o %t/executable -- * RUN: %t/executable %t/bitcode.bc -- * RUN: %ocamlopt -g -w +A -package llvm.vectorize -linkpkg %t/vectorize_opts.ml -o %t/executable -- * RUN: %t/executable %t/bitcode.bc -- * XFAIL: vg_leak -- *) -- --(* Note: It takes several seconds for ocamlopt to link an executable with -- libLLVMCore.a, so it's better to write a big test than a bunch of -- little ones. *) -- --open Llvm --open Llvm_vectorize --open Llvm_target -- --let context = global_context () --let void_type = Llvm.void_type context -- --(* Tiny unit test framework - really just to help find which line is busted *) --let print_checkpoints = false -- --let suite name f = -- if print_checkpoints then -- prerr_endline (name ^ ":"); -- f () -- -- --(*===-- Fixture -----------------------------------------------------------===*) -- --let filename = Sys.argv.(1) --let m = create_module context filename -- -- --(*===-- Transforms --------------------------------------------------------===*) -- --let test_transforms () = -- let (++) x f = f x; x in -- -- let fty = function_type void_type [| |] in -- let fn = define_function "fn" fty m in -- ignore (build_ret_void (builder_at_end context (entry_block fn))); -- -- ignore (PassManager.create () -- ++ add_loop_vectorize -- ++ add_slp_vectorize -- ++ PassManager.run_module m -- ++ PassManager.dispose) -- -- --(*===-- Driver ------------------------------------------------------------===*) -- --let _ = -- suite "transforms" test_transforms; -- dispose_module m -diff --git a/llvm/test/CMakeLists.txt b/llvm/test/CMakeLists.txt -index 5f52ce73c782..9339940baf58 100644 ---- a/llvm/test/CMakeLists.txt -+++ b/llvm/test/CMakeLists.txt -@@ -212,11 +212,7 @@ if(TARGET ocaml_llvm) - ocaml_llvm_irreader - ocaml_llvm_linker - ocaml_llvm_target -- ocaml_llvm_ipo -- ocaml_llvm_passmgr_builder -- ocaml_llvm_scalar_opts - ocaml_llvm_transform_utils -- ocaml_llvm_vectorize - ) - endif() - --- -2.39.2 - diff --git a/0003-IPO-Remove-various-legacy-passes.patch b/0003-IPO-Remove-various-legacy-passes.patch deleted file mode 100644 index 76330ff53a95..000000000000 --- a/0003-IPO-Remove-various-legacy-passes.patch +++ /dev/null @@ -1,826 +0,0 @@ -From 773d663e4729f55d23cb04f78a9d003643f2cb37 Mon Sep 17 00:00:00 2001 -From: Arthur Eubanks <aeubanks@google.com> -Date: Mon, 27 Feb 2023 19:00:37 -0800 -Subject: [PATCH] [IPO] Remove various legacy passes - -These are part of the optimization pipeline, of which the legacy pass manager version is deprecated and being removed. ---- - llvm/include/llvm-c/Transforms/IPO.h | 6 -- - llvm/include/llvm/InitializePasses.h | 2 - - llvm/include/llvm/LinkAllPasses.h | 6 -- - llvm/include/llvm/Transforms/IPO.h | 28 ------ - llvm/include/llvm/Transforms/IPO/Attributor.h | 3 - - .../llvm/Transforms/IPO/ForceFunctionAttrs.h | 4 - - .../llvm/Transforms/IPO/FunctionAttrs.h | 4 - - .../llvm/Transforms/IPO/InferFunctionAttrs.h | 5 - - .../Transforms/IPO/Annotation2Metadata.cpp | 28 ------ - llvm/lib/Transforms/IPO/Attributor.cpp | 95 ------------------- - llvm/lib/Transforms/IPO/ConstantMerge.cpp | 29 ------ - llvm/lib/Transforms/IPO/ElimAvailExtern.cpp | 30 ------ - .../lib/Transforms/IPO/ForceFunctionAttrs.cpp | 29 ------ - llvm/lib/Transforms/IPO/FunctionAttrs.cpp | 42 -------- - llvm/lib/Transforms/IPO/GlobalDCE.cpp | 41 -------- - llvm/lib/Transforms/IPO/IPO.cpp | 21 ---- - .../lib/Transforms/IPO/InferFunctionAttrs.cpp | 35 ------- - .../lib/Transforms/IPO/PassManagerBuilder.cpp | 41 -------- - llvm/test/CodeGen/ARM/pr26669.ll | 31 ------ - .../Other/opt-legacy-syntax-deprecation.ll | 2 +- - llvm/tools/bugpoint/ExtractFunction.cpp | 1 - - 21 files changed, 1 insertion(+), 482 deletions(-) - delete mode 100644 llvm/test/CodeGen/ARM/pr26669.ll - -diff --git a/llvm/include/llvm-c/Transforms/IPO.h b/llvm/include/llvm-c/Transforms/IPO.h -index 53aa20fbd886..c558aa37f1c3 100644 ---- a/llvm/include/llvm-c/Transforms/IPO.h -+++ b/llvm/include/llvm-c/Transforms/IPO.h -@@ -27,9 +27,6 @@ LLVM_C_EXTERN_C_BEGIN - * @{ - */ - --/** See llvm::createConstantMergePass function. */ --void LLVMAddConstantMergePass(LLVMPassManagerRef PM); -- - /** See llvm::createDeadArgEliminationPass function. */ - void LLVMAddDeadArgEliminationPass(LLVMPassManagerRef PM); - -@@ -39,9 +36,6 @@ void LLVMAddFunctionAttrsPass(LLVMPassManagerRef PM); - /** See llvm::createAlwaysInlinerPass function. */ - void LLVMAddAlwaysInlinerPass(LLVMPassManagerRef PM); - --/** See llvm::createGlobalDCEPass function. */ --void LLVMAddGlobalDCEPass(LLVMPassManagerRef PM); -- - /** - * @} - */ -diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h -index 2924b02774bd..2fdce85c2599 100644 ---- a/llvm/include/llvm/InitializePasses.h -+++ b/llvm/include/llvm/InitializePasses.h -@@ -60,8 +60,6 @@ void initializeAssumeBuilderPassLegacyPassPass(PassRegistry &); - void initializeAnnotation2MetadataLegacyPass(PassRegistry &); - void initializeAssumptionCacheTrackerPass(PassRegistry&); - void initializeAtomicExpandPass(PassRegistry&); --void initializeAttributorLegacyPassPass(PassRegistry&); --void initializeAttributorCGSCCLegacyPassPass(PassRegistry &); - void initializeBasicBlockSectionsProfileReaderPass(PassRegistry &); - void initializeBasicBlockSectionsPass(PassRegistry &); - void initializeBDCELegacyPassPass(PassRegistry&); -diff --git a/llvm/include/llvm/LinkAllPasses.h b/llvm/include/llvm/LinkAllPasses.h -index 8f07acd0bdf5..3f20916af2f3 100644 ---- a/llvm/include/llvm/LinkAllPasses.h -+++ b/llvm/include/llvm/LinkAllPasses.h -@@ -82,7 +82,6 @@ namespace { - (void) llvm::createCFGSimplificationPass(); - (void) llvm::createStructurizeCFGPass(); - (void) llvm::createLibCallsShrinkWrapPass(); -- (void) llvm::createConstantMergePass(); - (void) llvm::createCostModelAnalysisPass(); - (void) llvm::createDeadArgEliminationPass(); - (void) llvm::createDeadCodeEliminationPass(); -@@ -93,7 +92,6 @@ namespace { - (void) llvm::createDomOnlyViewerWrapperPassPass(); - (void) llvm::createDomViewerWrapperPassPass(); - (void) llvm::createAlwaysInlinerLegacyPass(); -- (void) llvm::createGlobalDCEPass(); - (void) llvm::createGlobalsAAWrapperPass(); - (void) llvm::createGuardWideningPass(); - (void) llvm::createLoopGuardWideningPass(); -@@ -154,9 +152,6 @@ namespace { - (void) llvm::createPostDomTree(); - (void) llvm::createInstructionNamerPass(); - (void) llvm::createMetaRenamerPass(); -- (void) llvm::createAttributorLegacyPass(); -- (void) llvm::createAttributorCGSCCLegacyPass(); -- (void) llvm::createPostOrderFunctionAttrsLegacyPass(); - (void) llvm::createMergeICmpsLegacyPass(); - (void) llvm::createExpandLargeDivRemPass(); - (void) llvm::createExpandMemCmpPass(); -@@ -185,7 +180,6 @@ namespace { - (void) llvm::createMustExecutePrinter(); - (void) llvm::createMustBeExecutedContextPrinter(); - (void) llvm::createFloat2IntPass(); -- (void) llvm::createEliminateAvailableExternallyPass(); - (void)llvm::createScalarizeMaskedMemIntrinLegacyPass(); - (void) llvm::createHardwareLoopsLegacyPass(); - (void) llvm::createInjectTLIMappingsLegacyPass(); -diff --git a/llvm/include/llvm/Transforms/IPO.h b/llvm/include/llvm/Transforms/IPO.h -index 4c6eb6f6e644..da2143625dc7 100644 ---- a/llvm/include/llvm/Transforms/IPO.h -+++ b/llvm/include/llvm/Transforms/IPO.h -@@ -27,34 +27,6 @@ class BasicBlock; - class GlobalValue; - class raw_ostream; - --//===----------------------------------------------------------------------===// --// --// This pass adds !annotation metadata to entries in the --// @llvm.global.annotations global constant. --// --ModulePass *createAnnotation2MetadataLegacyPass(); -- --//===----------------------------------------------------------------------===// --/// createConstantMergePass - This function returns a new pass that merges --/// duplicate global constants together into a single constant that is shared. --/// This is useful because some passes (ie TraceValues) insert a lot of string --/// constants into the program, regardless of whether or not they duplicate an --/// existing string. --/// --ModulePass *createConstantMergePass(); -- --//===----------------------------------------------------------------------===// --/// createGlobalDCEPass - This transform is designed to eliminate unreachable --/// internal globals (functions or global variables) --/// --ModulePass *createGlobalDCEPass(); -- --//===----------------------------------------------------------------------===// --/// This transform is designed to eliminate available external globals --/// (functions or global variables) --/// --ModulePass *createEliminateAvailableExternallyPass(); -- - //===----------------------------------------------------------------------===// - /// createGVExtractionPass - If deleteFn is true, this pass deletes - /// the specified global values. Otherwise, it deletes as much of the module as -diff --git a/llvm/include/llvm/Transforms/IPO/Attributor.h b/llvm/include/llvm/Transforms/IPO/Attributor.h -index 694a807d8861..968e482eff1b 100644 ---- a/llvm/include/llvm/Transforms/IPO/Attributor.h -+++ b/llvm/include/llvm/Transforms/IPO/Attributor.h -@@ -3223,9 +3223,6 @@ struct AttributorCGSCCPass : public PassInfoMixin<AttributorCGSCCPass> { - LazyCallGraph &CG, CGSCCUpdateResult &UR); - }; - --Pass *createAttributorLegacyPass(); --Pass *createAttributorCGSCCLegacyPass(); -- - /// Helper function to clamp a state \p S of type \p StateType with the - /// information in \p R and indicate/return if \p S did change (as-in update is - /// required to be run again). -diff --git a/llvm/include/llvm/Transforms/IPO/ForceFunctionAttrs.h b/llvm/include/llvm/Transforms/IPO/ForceFunctionAttrs.h -index 07c7cac77354..52667e19bc88 100644 ---- a/llvm/include/llvm/Transforms/IPO/ForceFunctionAttrs.h -+++ b/llvm/include/llvm/Transforms/IPO/ForceFunctionAttrs.h -@@ -17,7 +17,6 @@ - - namespace llvm { - class Module; --class Pass; - - /// Pass which forces specific function attributes into the IR, primarily as - /// a debugging tool. -@@ -25,9 +24,6 @@ struct ForceFunctionAttrsPass : PassInfoMixin<ForceFunctionAttrsPass> { - PreservedAnalyses run(Module &M, ModuleAnalysisManager &); - }; - --/// Create a legacy pass manager instance of a pass to force function attrs. --Pass *createForceFunctionAttrsLegacyPass(); -- - } - - #endif // LLVM_TRANSFORMS_IPO_FORCEFUNCTIONATTRS_H -diff --git a/llvm/include/llvm/Transforms/IPO/FunctionAttrs.h b/llvm/include/llvm/Transforms/IPO/FunctionAttrs.h -index fc7cca83496b..1cab52b2cca8 100644 ---- a/llvm/include/llvm/Transforms/IPO/FunctionAttrs.h -+++ b/llvm/include/llvm/Transforms/IPO/FunctionAttrs.h -@@ -52,10 +52,6 @@ struct PostOrderFunctionAttrsPass : PassInfoMixin<PostOrderFunctionAttrsPass> { - LazyCallGraph &CG, CGSCCUpdateResult &UR); - }; - --/// Create a legacy pass manager instance of a pass to compute function attrs --/// in post-order. --Pass *createPostOrderFunctionAttrsLegacyPass(); -- - /// A pass to do RPO deduction and propagation of function attributes. - /// - /// This pass provides a general RPO or "top down" propagation of -diff --git a/llvm/include/llvm/Transforms/IPO/InferFunctionAttrs.h b/llvm/include/llvm/Transforms/IPO/InferFunctionAttrs.h -index 880af2b46d7f..8addf49fc0d8 100644 ---- a/llvm/include/llvm/Transforms/IPO/InferFunctionAttrs.h -+++ b/llvm/include/llvm/Transforms/IPO/InferFunctionAttrs.h -@@ -19,7 +19,6 @@ - - namespace llvm { - class Module; --class Pass; - - /// A pass which infers function attributes from the names and signatures of - /// function declarations in a module. -@@ -27,10 +26,6 @@ struct InferFunctionAttrsPass : PassInfoMixin<InferFunctionAttrsPass> { - PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM); - }; - --/// Create a legacy pass manager instance of a pass to infer function --/// attributes. --Pass *createInferFunctionAttrsLegacyPass(); -- - } - - #endif // LLVM_TRANSFORMS_IPO_INFERFUNCTIONATTRS_H -diff --git a/llvm/lib/Transforms/IPO/Annotation2Metadata.cpp b/llvm/lib/Transforms/IPO/Annotation2Metadata.cpp -index 6cc04544cabc..7156e65f45a5 100644 ---- a/llvm/lib/Transforms/IPO/Annotation2Metadata.cpp -+++ b/llvm/lib/Transforms/IPO/Annotation2Metadata.cpp -@@ -64,34 +64,6 @@ static bool convertAnnotation2Metadata(Module &M) { - return true; - } - --namespace { --struct Annotation2MetadataLegacy : public ModulePass { -- static char ID; -- -- Annotation2MetadataLegacy() : ModulePass(ID) { -- initializeAnnotation2MetadataLegacyPass(*PassRegistry::getPassRegistry()); -- } -- -- bool runOnModule(Module &M) override { return convertAnnotation2Metadata(M); } -- -- void getAnalysisUsage(AnalysisUsage &AU) const override { -- AU.setPreservesAll(); -- } --}; -- --} // end anonymous namespace -- --char Annotation2MetadataLegacy::ID = 0; -- --INITIALIZE_PASS_BEGIN(Annotation2MetadataLegacy, DEBUG_TYPE, -- "Annotation2Metadata", false, false) --INITIALIZE_PASS_END(Annotation2MetadataLegacy, DEBUG_TYPE, -- "Annotation2Metadata", false, false) -- --ModulePass *llvm::createAnnotation2MetadataLegacyPass() { -- return new Annotation2MetadataLegacy(); --} -- - PreservedAnalyses Annotation2MetadataPass::run(Module &M, - ModuleAnalysisManager &AM) { - convertAnnotation2Metadata(M); -diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp -index 3485a9af1633..6cb74cd4aacd 100644 ---- a/llvm/lib/Transforms/IPO/Attributor.cpp -+++ b/llvm/lib/Transforms/IPO/Attributor.cpp -@@ -3747,98 +3747,3 @@ template <> struct DOTGraphTraits<AADepGraph *> : public DefaultDOTGraphTraits { - }; - - } // end namespace llvm -- --namespace { -- --struct AttributorLegacyPass : public ModulePass { -- static char ID; -- -- AttributorLegacyPass() : ModulePass(ID) { -- initializeAttributorLegacyPassPass(*PassRegistry::getPassRegistry()); -- } -- -- bool runOnModule(Module &M) override { -- if (skipModule(M)) -- return false; -- -- AnalysisGetter AG; -- SetVector<Function *> Functions; -- for (Function &F : M) -- Functions.insert(&F); -- -- CallGraphUpdater CGUpdater; -- BumpPtrAllocator Allocator; -- InformationCache InfoCache(M, AG, Allocator, /* CGSCC */ nullptr); -- return runAttributorOnFunctions(InfoCache, Functions, AG, CGUpdater, -- /* DeleteFns*/ true, -- /* IsModulePass */ true); -- } -- -- void getAnalysisUsage(AnalysisUsage &AU) const override { -- // FIXME: Think about passes we will preserve and add them here. -- AU.addRequired<TargetLibraryInfoWrapperPass>(); -- } --}; -- --struct AttributorCGSCCLegacyPass : public CallGraphSCCPass { -- static char ID; -- -- AttributorCGSCCLegacyPass() : CallGraphSCCPass(ID) { -- initializeAttributorCGSCCLegacyPassPass(*PassRegistry::getPassRegistry()); -- } -- -- bool runOnSCC(CallGraphSCC &SCC) override { -- if (skipSCC(SCC)) -- return false; -- -- SetVector<Function *> Functions; -- for (CallGraphNode *CGN : SCC) -- if (Function *Fn = CGN->getFunction()) -- if (!Fn->isDeclaration()) -- Functions.insert(Fn); -- -- if (Functions.empty()) -- return false; -- -- AnalysisGetter AG; -- CallGraph &CG = const_cast<CallGraph &>(SCC.getCallGraph()); -- CallGraphUpdater CGUpdater; -- CGUpdater.initialize(CG, SCC); -- Module &M = *Functions.back()->getParent(); -- BumpPtrAllocator Allocator; -- InformationCache InfoCache(M, AG, Allocator, /* CGSCC */ &Functions); -- return runAttributorOnFunctions(InfoCache, Functions, AG, CGUpdater, -- /* DeleteFns */ false, -- /* IsModulePass */ false); -- } -- -- void getAnalysisUsage(AnalysisUsage &AU) const override { -- // FIXME: Think about passes we will preserve and add them here. -- AU.addRequired<TargetLibraryInfoWrapperPass>(); -- CallGraphSCCPass::getAnalysisUsage(AU); -- } --}; -- --} // end anonymous namespace -- --Pass *llvm::createAttributorLegacyPass() { return new AttributorLegacyPass(); } --Pass *llvm::createAttributorCGSCCLegacyPass() { -- return new AttributorCGSCCLegacyPass(); --} -- --char AttributorLegacyPass::ID = 0; --char AttributorCGSCCLegacyPass::ID = 0; -- --INITIALIZE_PASS_BEGIN(AttributorLegacyPass, "attributor", -- "Deduce and propagate attributes", false, false) --INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass) --INITIALIZE_PASS_END(AttributorLegacyPass, "attributor", -- "Deduce and propagate attributes", false, false) --INITIALIZE_PASS_BEGIN(AttributorCGSCCLegacyPass, "attributor-cgscc", -- "Deduce and propagate attributes (CGSCC pass)", false, -- false) --INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass) --INITIALIZE_PASS_DEPENDENCY(CallGraphWrapperPass) --INITIALIZE_PASS_END(AttributorCGSCCLegacyPass, "attributor-cgscc", -- "Deduce and propagate attributes (CGSCC pass)", false, -- false) -diff --git a/llvm/lib/Transforms/IPO/ConstantMerge.cpp b/llvm/lib/Transforms/IPO/ConstantMerge.cpp -index 77bc377f4514..06d258fdb4e7 100644 ---- a/llvm/lib/Transforms/IPO/ConstantMerge.cpp -+++ b/llvm/lib/Transforms/IPO/ConstantMerge.cpp -@@ -251,32 +251,3 @@ PreservedAnalyses ConstantMergePass::run(Module &M, ModuleAnalysisManager &) { - return PreservedAnalyses::all(); - return PreservedAnalyses::none(); - } -- --namespace { -- --struct ConstantMergeLegacyPass : public ModulePass { -- static char ID; // Pass identification, replacement for typeid -- -- ConstantMergeLegacyPass() : ModulePass(ID) { -- initializeConstantMergeLegacyPassPass(*PassRegistry::getPassRegistry()); -- } -- -- // For this pass, process all of the globals in the module, eliminating -- // duplicate constants. -- bool runOnModule(Module &M) override { -- if (skipModule(M)) -- return false; -- return mergeConstants(M); -- } --}; -- --} // end anonymous namespace -- --char ConstantMergeLegacyPass::ID = 0; -- --INITIALIZE_PASS(ConstantMergeLegacyPass, "constmerge", -- "Merge Duplicate Global Constants", false, false) -- --ModulePass *llvm::createConstantMergePass() { -- return new ConstantMergeLegacyPass(); --} -diff --git a/llvm/lib/Transforms/IPO/ElimAvailExtern.cpp b/llvm/lib/Transforms/IPO/ElimAvailExtern.cpp -index 7f138d206fac..2ba1ff45b3db 100644 ---- a/llvm/lib/Transforms/IPO/ElimAvailExtern.cpp -+++ b/llvm/lib/Transforms/IPO/ElimAvailExtern.cpp -@@ -70,33 +70,3 @@ EliminateAvailableExternallyPass::run(Module &M, ModuleAnalysisManager &) { - return PreservedAnalyses::all(); - return PreservedAnalyses::none(); - } -- --namespace { -- --struct EliminateAvailableExternallyLegacyPass : public ModulePass { -- static char ID; // Pass identification, replacement for typeid -- -- EliminateAvailableExternallyLegacyPass() : ModulePass(ID) { -- initializeEliminateAvailableExternallyLegacyPassPass( -- *PassRegistry::getPassRegistry()); -- } -- -- // run - Do the EliminateAvailableExternally pass on the specified module, -- // optionally updating the specified callgraph to reflect the changes. -- bool runOnModule(Module &M) override { -- if (skipModule(M)) -- return false; -- return eliminateAvailableExternally(M); -- } --}; -- --} // end anonymous namespace -- --char EliminateAvailableExternallyLegacyPass::ID = 0; -- --INITIALIZE_PASS(EliminateAvailableExternallyLegacyPass, "elim-avail-extern", -- "Eliminate Available Externally Globals", false, false) -- --ModulePass *llvm::createEliminateAvailableExternallyPass() { -- return new EliminateAvailableExternallyLegacyPass(); --} -diff --git a/llvm/lib/Transforms/IPO/ForceFunctionAttrs.cpp b/llvm/lib/Transforms/IPO/ForceFunctionAttrs.cpp -index b10c2ea13469..2b8411d32fec 100644 ---- a/llvm/lib/Transforms/IPO/ForceFunctionAttrs.cpp -+++ b/llvm/lib/Transforms/IPO/ForceFunctionAttrs.cpp -@@ -80,32 +80,3 @@ PreservedAnalyses ForceFunctionAttrsPass::run(Module &M, - // Just conservatively invalidate analyses, this isn't likely to be important. - return PreservedAnalyses::none(); - } -- --namespace { --struct ForceFunctionAttrsLegacyPass : public ModulePass { -- static char ID; // Pass identification, replacement for typeid -- ForceFunctionAttrsLegacyPass() : ModulePass(ID) { -- initializeForceFunctionAttrsLegacyPassPass( -- *PassRegistry::getPassRegistry()); -- } -- -- bool runOnModule(Module &M) override { -- if (!hasForceAttributes()) -- return false; -- -- for (Function &F : M.functions()) -- forceAttributes(F); -- -- // Conservatively assume we changed something. -- return true; -- } --}; --} -- --char ForceFunctionAttrsLegacyPass::ID = 0; --INITIALIZE_PASS(ForceFunctionAttrsLegacyPass, "forceattrs", -- "Force set function attributes", false, false) -- --Pass *llvm::createForceFunctionAttrsLegacyPass() { -- return new ForceFunctionAttrsLegacyPass(); --} -diff --git a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp -index 76a89a8b673c..68a4860dc190 100644 ---- a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp -+++ b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp -@@ -1808,42 +1808,6 @@ PreservedAnalyses PostOrderFunctionAttrsPass::run(LazyCallGraph::SCC &C, - return PA; - } - --namespace { -- --struct PostOrderFunctionAttrsLegacyPass : public CallGraphSCCPass { -- // Pass identification, replacement for typeid -- static char ID; -- -- PostOrderFunctionAttrsLegacyPass() : CallGraphSCCPass(ID) { -- initializePostOrderFunctionAttrsLegacyPassPass( -- *PassRegistry::getPassRegistry()); -- } -- -- bool runOnSCC(CallGraphSCC &SCC) override; -- -- void getAnalysisUsage(AnalysisUsage &AU) const override { -- AU.setPreservesCFG(); -- AU.addRequired<AssumptionCacheTracker>(); -- getAAResultsAnalysisUsage(AU); -- CallGraphSCCPass::getAnalysisUsage(AU); -- } --}; -- --} // end anonymous namespace -- --char PostOrderFunctionAttrsLegacyPass::ID = 0; --INITIALIZE_PASS_BEGIN(PostOrderFunctionAttrsLegacyPass, "function-attrs", -- "Deduce function attributes", false, false) --INITIALIZE_PASS_DEPENDENCY(AAResultsWrapperPass) --INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker) --INITIALIZE_PASS_DEPENDENCY(CallGraphWrapperPass) --INITIALIZE_PASS_END(PostOrderFunctionAttrsLegacyPass, "function-attrs", -- "Deduce function attributes", false, false) -- --Pass *llvm::createPostOrderFunctionAttrsLegacyPass() { -- return new PostOrderFunctionAttrsLegacyPass(); --} -- - template <typename AARGetterT> - static bool runImpl(CallGraphSCC &SCC, AARGetterT AARGetter) { - SmallVector<Function *, 8> Functions; -@@ -1854,12 +1818,6 @@ static bool runImpl(CallGraphSCC &SCC, AARGetterT AARGetter) { - return !deriveAttrsInPostOrder(Functions, AARGetter).empty(); - } - --bool PostOrderFunctionAttrsLegacyPass::runOnSCC(CallGraphSCC &SCC) { -- if (skipSCC(SCC)) -- return false; -- return runImpl(SCC, LegacyAARGetter(*this)); --} -- - static bool addNoRecurseAttrsTopDown(Function &F) { - // We check the preconditions for the function prior to calling this to avoid - // the cost of building up a reversible post-order list. We assert them here -diff --git a/llvm/lib/Transforms/IPO/GlobalDCE.cpp b/llvm/lib/Transforms/IPO/GlobalDCE.cpp -index 2f2bb174a8c8..4aa5ae8f6a03 100644 ---- a/llvm/lib/Transforms/IPO/GlobalDCE.cpp -+++ b/llvm/lib/Transforms/IPO/GlobalDCE.cpp -@@ -42,47 +42,6 @@ STATISTIC(NumIFuncs, "Number of indirect functions removed"); - STATISTIC(NumVariables, "Number of global variables removed"); - STATISTIC(NumVFuncs, "Number of virtual functions removed"); - --namespace { -- class GlobalDCELegacyPass : public ModulePass { -- public: -- static char ID; // Pass identification, replacement for typeid -- GlobalDCELegacyPass() : ModulePass(ID) { -- initializeGlobalDCELegacyPassPass(*PassRegistry::getPassRegistry()); -- } -- -- // run - Do the GlobalDCE pass on the specified module, optionally updating -- // the specified callgraph to reflect the changes. -- // -- bool runOnModule(Module &M) override { -- if (skipModule(M)) -- return false; -- -- // We need a minimally functional dummy module analysis manager. It needs -- // to at least know about the possibility of proxying a function analysis -- // manager. -- FunctionAnalysisManager DummyFAM; -- ModuleAnalysisManager DummyMAM; -- DummyMAM.registerPass( -- [&] { return FunctionAnalysisManagerModuleProxy(DummyFAM); }); -- -- auto PA = Impl.run(M, DummyMAM); -- return !PA.areAllPreserved(); -- } -- -- private: -- GlobalDCEPass Impl; -- }; --} -- --char GlobalDCELegacyPass::ID = 0; --INITIALIZE_PASS(GlobalDCELegacyPass, "globaldce", -- "Dead Global Elimination", false, false) -- --// Public interface to the GlobalDCEPass. --ModulePass *llvm::createGlobalDCEPass() { -- return new GlobalDCELegacyPass(); --} -- - /// Returns true if F is effectively empty. - static bool isEmptyFunction(Function *F) { - // Skip external functions. -diff --git a/llvm/lib/Transforms/IPO/IPO.cpp b/llvm/lib/Transforms/IPO/IPO.cpp -index 6fa706a91b0b..eb0a91bbbc90 100644 ---- a/llvm/lib/Transforms/IPO/IPO.cpp -+++ b/llvm/lib/Transforms/IPO/IPO.cpp -@@ -23,43 +23,22 @@ - using namespace llvm; - - void llvm::initializeIPO(PassRegistry &Registry) { -- initializeAnnotation2MetadataLegacyPass(Registry); -- initializeConstantMergeLegacyPassPass(Registry); - initializeDAEPass(Registry); - initializeDAHPass(Registry); -- initializeForceFunctionAttrsLegacyPassPass(Registry); -- initializeGlobalDCELegacyPassPass(Registry); - initializeAlwaysInlinerLegacyPassPass(Registry); -- initializeInferFunctionAttrsLegacyPassPass(Registry); - initializeLoopExtractorLegacyPassPass(Registry); - initializeSingleLoopExtractorPass(Registry); -- initializeAttributorLegacyPassPass(Registry); -- initializeAttributorCGSCCLegacyPassPass(Registry); -- initializePostOrderFunctionAttrsLegacyPassPass(Registry); - initializeBarrierNoopPass(Registry); -- initializeEliminateAvailableExternallyLegacyPassPass(Registry); - } - - void LLVMInitializeIPO(LLVMPassRegistryRef R) { - initializeIPO(*unwrap(R)); - } - --void LLVMAddConstantMergePass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createConstantMergePass()); --} -- - void LLVMAddDeadArgEliminationPass(LLVMPassManagerRef PM) { - unwrap(PM)->add(createDeadArgEliminationPass()); - } - --void LLVMAddFunctionAttrsPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createPostOrderFunctionAttrsLegacyPass()); --} -- - void LLVMAddAlwaysInlinerPass(LLVMPassManagerRef PM) { - unwrap(PM)->add(llvm::createAlwaysInlinerLegacyPass()); - } -- --void LLVMAddGlobalDCEPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createGlobalDCEPass()); --} -diff --git a/llvm/lib/Transforms/IPO/InferFunctionAttrs.cpp b/llvm/lib/Transforms/IPO/InferFunctionAttrs.cpp -index 76f8f1a7a482..b4f7967ec60a 100644 ---- a/llvm/lib/Transforms/IPO/InferFunctionAttrs.cpp -+++ b/llvm/lib/Transforms/IPO/InferFunctionAttrs.cpp -@@ -52,38 +52,3 @@ PreservedAnalyses InferFunctionAttrsPass::run(Module &M, - // out all the passes. - return PreservedAnalyses::none(); - } -- --namespace { --struct InferFunctionAttrsLegacyPass : public ModulePass { -- static char ID; // Pass identification, replacement for typeid -- InferFunctionAttrsLegacyPass() : ModulePass(ID) { -- initializeInferFunctionAttrsLegacyPassPass( -- *PassRegistry::getPassRegistry()); -- } -- -- void getAnalysisUsage(AnalysisUsage &AU) const override { -- AU.addRequired<TargetLibraryInfoWrapperPass>(); -- } -- -- bool runOnModule(Module &M) override { -- if (skipModule(M)) -- return false; -- -- auto GetTLI = [this](Function &F) -> TargetLibraryInfo & { -- return this->getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(F); -- }; -- return inferAllPrototypeAttributes(M, GetTLI); -- } --}; --} -- --char InferFunctionAttrsLegacyPass::ID = 0; --INITIALIZE_PASS_BEGIN(InferFunctionAttrsLegacyPass, "inferattrs", -- "Infer set function attributes", false, false) --INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass) --INITIALIZE_PASS_END(InferFunctionAttrsLegacyPass, "inferattrs", -- "Infer set function attributes", false, false) -- --Pass *llvm::createInferFunctionAttrsLegacyPass() { -- return new InferFunctionAttrsLegacyPass(); --} -diff --git a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp -index ed394a1822de..4fdd2c9073ac 100644 ---- a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp -+++ b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp -@@ -273,11 +273,6 @@ void PassManagerBuilder::addVectorPasses(legacy::PassManagerBase &PM, - - void PassManagerBuilder::populateModulePassManager( - legacy::PassManagerBase &MPM) { -- MPM.add(createAnnotation2MetadataLegacyPass()); -- -- // Allow forcing function attributes as a debugging and tuning aid. -- MPM.add(createForceFunctionAttrsLegacyPass()); -- - // If all optimizations are disabled, just run the always-inline pass and, - // if enabled, the function merging pass. - if (OptLevel == 0) { -@@ -295,9 +290,6 @@ void PassManagerBuilder::populateModulePassManager( - - addInitialAliasAnalysisPasses(MPM); - -- // Infer attributes about declarations if possible. -- MPM.add(createInferFunctionAttrsLegacyPass()); -- - if (OptLevel > 2) - MPM.add(createCallSiteSplittingPass()); - -@@ -317,15 +309,11 @@ void PassManagerBuilder::populateModulePassManager( - MPM.add(createGlobalsAAWrapperPass()); - - // Start of CallGraph SCC passes. -- bool RunInliner = false; - if (Inliner) { - MPM.add(Inliner); - Inliner = nullptr; -- RunInliner = true; - } - -- MPM.add(createPostOrderFunctionAttrsLegacyPass()); -- - addFunctionSimplificationPasses(MPM); - - // FIXME: This is a HACK! The inliner pass above implicitly creates a CGSCC -@@ -333,28 +321,6 @@ void PassManagerBuilder::populateModulePassManager( - // we must insert a no-op module pass to reset the pass manager. - MPM.add(createBarrierNoopPass()); - -- if (OptLevel > 1) -- // Remove avail extern fns and globals definitions if we aren't -- // compiling an object file for later LTO. For LTO we want to preserve -- // these so they are eligible for inlining at link-time. Note if they -- // are unreferenced they will be removed by GlobalDCE later, so -- // this only impacts referenced available externally globals. -- // Eventually they will be suppressed during codegen, but eliminating -- // here enables more opportunity for GlobalDCE as it may make -- // globals referenced by available external functions dead -- // and saves running remaining passes on the eliminated functions. -- MPM.add(createEliminateAvailableExternallyPass()); -- -- // The inliner performs some kind of dead code elimination as it goes, -- // but there are cases that are not really caught by it. We might -- // at some point consider teaching the inliner about them, but it -- // is OK for now to run GlobalOpt + GlobalDCE in tandem as their -- // benefits generally outweight the cost, making the whole pipeline -- // faster. -- if (RunInliner) { -- MPM.add(createGlobalDCEPass()); -- } -- - // We add a fresh GlobalsModRef run at this point. This is particularly - // useful as the above will have inlined, DCE'ed, and function-attr - // propagated everything. We should at this point have a reasonably minimal -@@ -382,13 +348,6 @@ void PassManagerBuilder::populateModulePassManager( - - addVectorPasses(MPM, /* IsFullLTO */ false); - -- // GlobalOpt already deletes dead functions and globals, at -O2 try a -- // late pass of GlobalDCE. It is capable of deleting dead cycles. -- if (OptLevel > 1) { -- MPM.add(createGlobalDCEPass()); // Remove dead fns and globals. -- MPM.add(createConstantMergePass()); // Merge dup global constants -- } -- - // LoopSink pass sinks instructions hoisted by LICM, which serves as a - // canonicalization pass that enables other optimizations. As a result, - // LoopSink pass needs to be a very late IR pass to avoid undoing LICM -diff --git a/llvm/test/CodeGen/ARM/pr26669.ll b/llvm/test/CodeGen/ARM/pr26669.ll -deleted file mode 100644 -index b3de1843da38..000000000000 ---- a/llvm/test/CodeGen/ARM/pr26669.ll -+++ /dev/null -@@ -1,31 +0,0 @@ --; RUN: opt -S -globaldce -sjljehprepare < %s | FileCheck %s --target datalayout = "e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32" --target triple = "thumbv7--ios5.0.0" -- --define void @g() personality ptr @__gxx_personality_sj0 { --entry: -- %exn.slot = alloca ptr -- %ehselector.slot = alloca i32 -- invoke void @f() -- to label %try.cont unwind label %lpad -- --lpad: ; preds = %entry -- %0 = landingpad { ptr, i32 } -- cleanup -- br label %try.cont -- --try.cont: ; preds = %catch, %invoke.cont -- ret void --} -- --declare void @f() -- --declare i32 @__gxx_personality_sj0(...) -- --; CHECK-LABEL: define void @g( --; CHECK: call void @llvm.eh.sjlj.callsite( --; CHECK: call void @_Unwind_SjLj_Register( --; CHECK: invoke void @f( --; CHECK: landingpad --; CHECK-NEXT: cleanup --; CHECK: call void @_Unwind_SjLj_Unregister( -diff --git a/llvm/test/Other/opt-legacy-syntax-deprecation.ll b/llvm/test/Other/opt-legacy-syntax-deprecation.ll -index b7247a7ceef4..a5a33564fd7e 100644 ---- a/llvm/test/Other/opt-legacy-syntax-deprecation.ll -+++ b/llvm/test/Other/opt-legacy-syntax-deprecation.ll -@@ -3,7 +3,7 @@ - ; RUN: opt /dev/null -disable-output 2>&1 | FileCheck %s --check-prefix=OK --allow-empty - ; RUN: opt /dev/null -disable-output -passes=instcombine 2>&1 | FileCheck %s --check-prefix=OK --allow-empty - ; RUN: not opt /dev/null -disable-output -instcombine 2>&1 | FileCheck %s --check-prefix=WARN --; RUN: not opt /dev/null -disable-output -instcombine -globaldce 2>&1 | FileCheck %s --check-prefix=WARN -+; RUN: not opt /dev/null -disable-output -instcombine -always-inline 2>&1 | FileCheck %s --check-prefix=WARN - ; RUN: opt /dev/null -disable-output -instcombine -enable-new-pm=0 2>&1 | FileCheck %s --check-prefix=OK --allow-empty - ; RUN: opt /dev/null -disable-output -codegenprepare -mtriple=x86_64-unknown-linux-gnu 2>&1 | FileCheck %s --check-prefix=OK --allow-empty - -diff --git a/llvm/tools/bugpoint/ExtractFunction.cpp b/llvm/tools/bugpoint/ExtractFunction.cpp -index 5047aa35d7e7..dd9a82c32035 100644 ---- a/llvm/tools/bugpoint/ExtractFunction.cpp -+++ b/llvm/tools/bugpoint/ExtractFunction.cpp -@@ -133,7 +133,6 @@ BugDriver::performFinalCleanups(std::unique_ptr<Module> M, - I->setLinkage(GlobalValue::ExternalLinkage); - - std::vector<std::string> CleanupPasses; -- CleanupPasses.push_back("globaldce"); - - if (MayModifySemantics) - CleanupPasses.push_back("deadarghaX0r"); --- -2.39.2 - diff --git a/0004-llvm-c-Remove-bindings-for-creating-legacy-passes.patch b/0004-llvm-c-Remove-bindings-for-creating-legacy-passes.patch deleted file mode 100644 index a9dfd87457cd..000000000000 --- a/0004-llvm-c-Remove-bindings-for-creating-legacy-passes.patch +++ /dev/null @@ -1,714 +0,0 @@ -From f7ca01333214f934c580c162afdee933e7430b6c Mon Sep 17 00:00:00 2001 -From: Nikita Popov <npopov@redhat.com> -Date: Tue, 28 Feb 2023 16:38:45 +0100 -Subject: [PATCH] [llvm-c] Remove bindings for creating legacy passes - -Legacy passes are only supported for codegen, and I don't believe -it's possible to write backends using the C API, so we should drop -all of those. Reduces the number of places that need to be modified -when removing legacy passes. - -Differential Revision: https://reviews.llvm.org/D144970 ---- - clang/docs/tools/clang-formatted-files.txt | 2 - - llvm/docs/ReleaseNotes.rst | 2 + - llvm/include/llvm-c/Transforms/IPO.h | 45 ----- - llvm/include/llvm-c/Transforms/InstCombine.h | 40 ----- - llvm/include/llvm-c/Transforms/Scalar.h | 152 ----------------- - llvm/include/llvm-c/Transforms/Utils.h | 50 ------ - llvm/include/llvm-c/Transforms/Vectorize.h | 47 ------ - llvm/lib/Transforms/IPO/IPO.cpp | 9 - - .../InstCombine/InstructionCombining.cpp | 5 - - llvm/lib/Transforms/Scalar/Scalar.cpp | 158 ------------------ - llvm/lib/Transforms/Utils/Utils.cpp | 13 -- - llvm/lib/Transforms/Vectorize/Vectorize.cpp | 9 - - llvm/tools/llvm-c-test/include-all.c | 6 +- - 13 files changed, 3 insertions(+), 535 deletions(-) - delete mode 100644 llvm/include/llvm-c/Transforms/IPO.h - delete mode 100644 llvm/include/llvm-c/Transforms/InstCombine.h - delete mode 100644 llvm/include/llvm-c/Transforms/Scalar.h - delete mode 100644 llvm/include/llvm-c/Transforms/Utils.h - delete mode 100644 llvm/include/llvm-c/Transforms/Vectorize.h - -diff --git a/clang/docs/tools/clang-formatted-files.txt b/clang/docs/tools/clang-formatted-files.txt -index 45970232d0c0..31d1dd7f365a 100644 ---- a/clang/docs/tools/clang-formatted-files.txt -+++ b/clang/docs/tools/clang-formatted-files.txt -@@ -5713,8 +5713,6 @@ llvm/include/llvm-c/OrcEE.h - llvm/include/llvm-c/Remarks.h - llvm/include/llvm-c/Types.h - llvm/include/llvm-c/Transforms/PassBuilder.h --llvm/include/llvm-c/Transforms/Scalar.h --llvm/include/llvm-c/Transforms/Vectorize.h - llvm/lib/Analysis/CodeMetrics.cpp - llvm/lib/Analysis/CycleAnalysis.cpp - llvm/lib/Analysis/DDGPrinter.cpp -diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst -index ef7dacd82bf0..aed1df36b490 100644 ---- a/llvm/docs/ReleaseNotes.rst -+++ b/llvm/docs/ReleaseNotes.rst -@@ -145,6 +145,8 @@ Changes to the C API - - * ``LLVMContextSetOpaquePointers``, a temporary API to pin to legacy typed - pointer, has been removed. -+* Functions for adding legacy passes like ``LLVMAddInstructionCombiningPass`` -+ have been removed. - - Changes to the FastISel infrastructure - -------------------------------------- -diff --git a/llvm/include/llvm-c/Transforms/IPO.h b/llvm/include/llvm-c/Transforms/IPO.h -deleted file mode 100644 -index c558aa37f1c3..000000000000 ---- a/llvm/include/llvm-c/Transforms/IPO.h -+++ /dev/null -@@ -1,45 +0,0 @@ --/*===-- IPO.h - Interprocedural Transformations C Interface -----*- C++ -*-===*\ --|* *| --|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| --|* Exceptions. *| --|* See https://llvm.org/LICENSE.txt for license information. *| --|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| --|* *| --|*===----------------------------------------------------------------------===*| --|* *| --|* This header declares the C interface to libLLVMIPO.a, which implements *| --|* various interprocedural transformations of the LLVM IR. *| --|* *| --\*===----------------------------------------------------------------------===*/ -- --#ifndef LLVM_C_TRANSFORMS_IPO_H --#define LLVM_C_TRANSFORMS_IPO_H -- --#include "llvm-c/ExternC.h" --#include "llvm-c/Types.h" -- --LLVM_C_EXTERN_C_BEGIN -- --/** -- * @defgroup LLVMCTransformsIPO Interprocedural transformations -- * @ingroup LLVMCTransforms -- * -- * @{ -- */ -- --/** See llvm::createDeadArgEliminationPass function. */ --void LLVMAddDeadArgEliminationPass(LLVMPassManagerRef PM); -- --/** See llvm::createFunctionAttrsPass function. */ --void LLVMAddFunctionAttrsPass(LLVMPassManagerRef PM); -- --/** See llvm::createAlwaysInlinerPass function. */ --void LLVMAddAlwaysInlinerPass(LLVMPassManagerRef PM); -- --/** -- * @} -- */ -- --LLVM_C_EXTERN_C_END -- --#endif -diff --git a/llvm/include/llvm-c/Transforms/InstCombine.h b/llvm/include/llvm-c/Transforms/InstCombine.h -deleted file mode 100644 -index ebe17d667061..000000000000 ---- a/llvm/include/llvm-c/Transforms/InstCombine.h -+++ /dev/null -@@ -1,40 +0,0 @@ --/*===-- Scalar.h - Scalar Transformation Library C Interface ----*- C++ -*-===*\ --|* *| --|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| --|* Exceptions. *| --|* See https://llvm.org/LICENSE.txt for license information. *| --|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| --|* *| --|*===----------------------------------------------------------------------===*| --|* *| --|* This header declares the C interface to libLLVMInstCombine.a, which *| --|* combines instructions to form fewer, simple IR instructions. *| --|* *| --\*===----------------------------------------------------------------------===*/ -- --#ifndef LLVM_C_TRANSFORMS_INSTCOMBINE_H --#define LLVM_C_TRANSFORMS_INSTCOMBINE_H -- --#include "llvm-c/ExternC.h" --#include "llvm-c/Types.h" -- --LLVM_C_EXTERN_C_BEGIN -- --/** -- * @defgroup LLVMCTransformsInstCombine Instruction Combining transformations -- * @ingroup LLVMCTransforms -- * -- * @{ -- */ -- --/** See llvm::createInstructionCombiningPass function. */ --void LLVMAddInstructionCombiningPass(LLVMPassManagerRef PM); -- --/** -- * @} -- */ -- --LLVM_C_EXTERN_C_END -- --#endif -- -diff --git a/llvm/include/llvm-c/Transforms/Scalar.h b/llvm/include/llvm-c/Transforms/Scalar.h -deleted file mode 100644 -index 8eefe7bec457..000000000000 ---- a/llvm/include/llvm-c/Transforms/Scalar.h -+++ /dev/null -@@ -1,152 +0,0 @@ --/*===-- Scalar.h - Scalar Transformation Library C Interface ----*- C++ -*-===*\ --|* *| --|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| --|* Exceptions. *| --|* See https://llvm.org/LICENSE.txt for license information. *| --|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| --|* *| --|*===----------------------------------------------------------------------===*| --|* *| --|* This header declares the C interface to libLLVMScalarOpts.a, which *| --|* implements various scalar transformations of the LLVM IR. *| --|* *| --|* Many exotic languages can interoperate with C code but have a harder time *| --|* with C++ due to name mangling. So in addition to C, this interface enables *| --|* tools written in such languages. *| --|* *| --\*===----------------------------------------------------------------------===*/ -- --#ifndef LLVM_C_TRANSFORMS_SCALAR_H --#define LLVM_C_TRANSFORMS_SCALAR_H -- --#include "llvm-c/ExternC.h" --#include "llvm-c/Types.h" -- --LLVM_C_EXTERN_C_BEGIN -- --/** -- * @defgroup LLVMCTransformsScalar Scalar transformations -- * @ingroup LLVMCTransforms -- * -- * @{ -- */ -- --/** See llvm::createAggressiveDCEPass function. */ --void LLVMAddAggressiveDCEPass(LLVMPassManagerRef PM); -- --/** See llvm::createDeadCodeEliminationPass function. */ --void LLVMAddDCEPass(LLVMPassManagerRef PM); -- --/** See llvm::createBitTrackingDCEPass function. */ --void LLVMAddBitTrackingDCEPass(LLVMPassManagerRef PM); -- --/** See llvm::createAlignmentFromAssumptionsPass function. */ --void LLVMAddAlignmentFromAssumptionsPass(LLVMPassManagerRef PM); -- --/** See llvm::createCFGSimplificationPass function. */ --void LLVMAddCFGSimplificationPass(LLVMPassManagerRef PM); -- --/** See llvm::createDeadStoreEliminationPass function. */ --void LLVMAddDeadStoreEliminationPass(LLVMPassManagerRef PM); -- --/** See llvm::createScalarizerPass function. */ --void LLVMAddScalarizerPass(LLVMPassManagerRef PM); -- --/** See llvm::createMergedLoadStoreMotionPass function. */ --void LLVMAddMergedLoadStoreMotionPass(LLVMPassManagerRef PM); -- --/** See llvm::createGVNPass function. */ --void LLVMAddGVNPass(LLVMPassManagerRef PM); -- --/** See llvm::createGVNPass function. */ --void LLVMAddNewGVNPass(LLVMPassManagerRef PM); -- --/** See llvm::createIndVarSimplifyPass function. */ --void LLVMAddIndVarSimplifyPass(LLVMPassManagerRef PM); -- --/** See llvm::createInstructionCombiningPass function. */ --void LLVMAddInstructionCombiningPass(LLVMPassManagerRef PM); -- --/** See llvm::createInstSimplifyLegacyPass function. */ --void LLVMAddInstructionSimplifyPass(LLVMPassManagerRef PM); -- --/** See llvm::createJumpThreadingPass function. */ --void LLVMAddJumpThreadingPass(LLVMPassManagerRef PM); -- --/** See llvm::createLICMPass function. */ --void LLVMAddLICMPass(LLVMPassManagerRef PM); -- --/** See llvm::createLoopRotatePass function. */ --void LLVMAddLoopRotatePass(LLVMPassManagerRef PM); -- --/** See llvm::createLoopUnrollPass function. */ --void LLVMAddLoopUnrollPass(LLVMPassManagerRef PM); -- --/** See llvm::createLowerAtomicPass function. */ --void LLVMAddLowerAtomicPass(LLVMPassManagerRef PM); -- --/** See llvm::createMemCpyOptPass function. */ --void LLVMAddMemCpyOptPass(LLVMPassManagerRef PM); -- --/** See llvm::createPartiallyInlineLibCallsPass function. */ --void LLVMAddPartiallyInlineLibCallsPass(LLVMPassManagerRef PM); -- --/** See llvm::createReassociatePass function. */ --void LLVMAddReassociatePass(LLVMPassManagerRef PM); -- --/** See llvm::createSROAPass function. */ --void LLVMAddScalarReplAggregatesPass(LLVMPassManagerRef PM); -- --/** See llvm::createSROAPass function. */ --void LLVMAddScalarReplAggregatesPassSSA(LLVMPassManagerRef PM); -- --/** See llvm::createSROAPass function. */ --void LLVMAddScalarReplAggregatesPassWithThreshold(LLVMPassManagerRef PM, -- int Threshold); -- --/** See llvm::createSimplifyLibCallsPass function. */ --void LLVMAddSimplifyLibCallsPass(LLVMPassManagerRef PM); -- --/** See llvm::createTailCallEliminationPass function. */ --void LLVMAddTailCallEliminationPass(LLVMPassManagerRef PM); -- --/** See llvm::demotePromoteMemoryToRegisterPass function. */ --void LLVMAddDemoteMemoryToRegisterPass(LLVMPassManagerRef PM); -- --/** See llvm::createVerifierPass function. */ --void LLVMAddVerifierPass(LLVMPassManagerRef PM); -- --/** See llvm::createCorrelatedValuePropagationPass function */ --void LLVMAddCorrelatedValuePropagationPass(LLVMPassManagerRef PM); -- --/** See llvm::createEarlyCSEPass function */ --void LLVMAddEarlyCSEPass(LLVMPassManagerRef PM); -- --/** See llvm::createEarlyCSEPass function */ --void LLVMAddEarlyCSEMemSSAPass(LLVMPassManagerRef PM); -- --/** See llvm::createLowerExpectIntrinsicPass function */ --void LLVMAddLowerExpectIntrinsicPass(LLVMPassManagerRef PM); -- --/** See llvm::createLowerConstantIntrinsicsPass function */ --void LLVMAddLowerConstantIntrinsicsPass(LLVMPassManagerRef PM); -- --/** See llvm::createTypeBasedAliasAnalysisPass function */ --void LLVMAddTypeBasedAliasAnalysisPass(LLVMPassManagerRef PM); -- --/** See llvm::createScopedNoAliasAAPass function */ --void LLVMAddScopedNoAliasAAPass(LLVMPassManagerRef PM); -- --/** See llvm::createBasicAliasAnalysisPass function */ --void LLVMAddBasicAliasAnalysisPass(LLVMPassManagerRef PM); -- --/** See llvm::createUnifyFunctionExitNodesPass function */ --void LLVMAddUnifyFunctionExitNodesPass(LLVMPassManagerRef PM); -- --/** -- * @} -- */ -- --LLVM_C_EXTERN_C_END -- --#endif -diff --git a/llvm/include/llvm-c/Transforms/Utils.h b/llvm/include/llvm-c/Transforms/Utils.h -deleted file mode 100644 -index 30d1ae63de1d..000000000000 ---- a/llvm/include/llvm-c/Transforms/Utils.h -+++ /dev/null -@@ -1,50 +0,0 @@ --/*===-- Utils.h - Transformation Utils Library C Interface ------*- C++ -*-===*\ --|* *| --|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| --|* Exceptions. *| --|* See https://llvm.org/LICENSE.txt for license information. *| --|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| --|* *| --|*===----------------------------------------------------------------------===*| --|* *| --|* This header declares the C interface to libLLVMTransformUtils.a, which *| --|* implements various transformation utilities of the LLVM IR. *| --|* *| --|* Many exotic languages can interoperate with C code but have a harder time *| --|* with C++ due to name mangling. So in addition to C, this interface enables *| --|* tools written in such languages. *| --|* *| --\*===----------------------------------------------------------------------===*/ -- --#ifndef LLVM_C_TRANSFORMS_UTILS_H --#define LLVM_C_TRANSFORMS_UTILS_H -- --#include "llvm-c/ExternC.h" --#include "llvm-c/Types.h" -- --LLVM_C_EXTERN_C_BEGIN -- --/** -- * @defgroup LLVMCTransformsUtils Transformation Utilities -- * @ingroup LLVMCTransforms -- * -- * @{ -- */ -- --/** See llvm::createLowerSwitchPass function. */ --void LLVMAddLowerSwitchPass(LLVMPassManagerRef PM); -- --/** See llvm::createPromoteMemoryToRegisterPass function. */ --void LLVMAddPromoteMemoryToRegisterPass(LLVMPassManagerRef PM); -- --/** See llvm::createAddDiscriminatorsPass function. */ --void LLVMAddAddDiscriminatorsPass(LLVMPassManagerRef PM); -- --/** -- * @} -- */ -- --LLVM_C_EXTERN_C_END -- --#endif -- -diff --git a/llvm/include/llvm-c/Transforms/Vectorize.h b/llvm/include/llvm-c/Transforms/Vectorize.h -deleted file mode 100644 -index 0de458381399..000000000000 ---- a/llvm/include/llvm-c/Transforms/Vectorize.h -+++ /dev/null -@@ -1,47 +0,0 @@ --/*===---------------------------Vectorize.h --------------------- -*- C -*-===*\ --|*===----------- Vectorization Transformation Library C Interface ---------===*| --|* *| --|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| --|* Exceptions. *| --|* See https://llvm.org/LICENSE.txt for license information. *| --|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| --|* *| --|*===----------------------------------------------------------------------===*| --|* *| --|* This header declares the C interface to libLLVMVectorize.a, which *| --|* implements various vectorization transformations of the LLVM IR. *| --|* *| --|* Many exotic languages can interoperate with C code but have a harder time *| --|* with C++ due to name mangling. So in addition to C, this interface enables *| --|* tools written in such languages. *| --|* *| --\*===----------------------------------------------------------------------===*/ -- --#ifndef LLVM_C_TRANSFORMS_VECTORIZE_H --#define LLVM_C_TRANSFORMS_VECTORIZE_H -- --#include "llvm-c/ExternC.h" --#include "llvm-c/Types.h" -- --LLVM_C_EXTERN_C_BEGIN -- --/** -- * @defgroup LLVMCTransformsVectorize Vectorization transformations -- * @ingroup LLVMCTransforms -- * -- * @{ -- */ -- --/** See llvm::createLoopVectorizePass function. */ --void LLVMAddLoopVectorizePass(LLVMPassManagerRef PM); -- --/** See llvm::createSLPVectorizerPass function. */ --void LLVMAddSLPVectorizePass(LLVMPassManagerRef PM); -- --/** -- * @} -- */ -- --LLVM_C_EXTERN_C_END -- --#endif -diff --git a/llvm/lib/Transforms/IPO/IPO.cpp b/llvm/lib/Transforms/IPO/IPO.cpp -index eb0a91bbbc90..fcd58898c88b 100644 ---- a/llvm/lib/Transforms/IPO/IPO.cpp -+++ b/llvm/lib/Transforms/IPO/IPO.cpp -@@ -12,7 +12,6 @@ - // - //===----------------------------------------------------------------------===// - --#include "llvm-c/Transforms/IPO.h" - #include "llvm-c/Initialization.h" - #include "llvm/IR/LegacyPassManager.h" - #include "llvm/InitializePasses.h" -@@ -34,11 +33,3 @@ void llvm::initializeIPO(PassRegistry &Registry) { - void LLVMInitializeIPO(LLVMPassRegistryRef R) { - initializeIPO(*unwrap(R)); - } -- --void LLVMAddDeadArgEliminationPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createDeadArgEliminationPass()); --} -- --void LLVMAddAlwaysInlinerPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(llvm::createAlwaysInlinerLegacyPass()); --} -diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp -index 34d1b2b46db2..c3ba452e3341 100644 ---- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp -+++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp -@@ -34,7 +34,6 @@ - - #include "InstCombineInternal.h" - #include "llvm-c/Initialization.h" --#include "llvm-c/Transforms/InstCombine.h" - #include "llvm/ADT/APInt.h" - #include "llvm/ADT/ArrayRef.h" - #include "llvm/ADT/DenseMap.h" -@@ -4760,7 +4759,3 @@ FunctionPass *llvm::createInstructionCombiningPass() { - FunctionPass *llvm::createInstructionCombiningPass(unsigned MaxIterations) { - return new InstructionCombiningPass(MaxIterations); - } -- --void LLVMAddInstructionCombiningPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createInstructionCombiningPass()); --} -diff --git a/llvm/lib/Transforms/Scalar/Scalar.cpp b/llvm/lib/Transforms/Scalar/Scalar.cpp -index c2b9350933d4..9a3d243859be 100644 ---- a/llvm/lib/Transforms/Scalar/Scalar.cpp -+++ b/llvm/lib/Transforms/Scalar/Scalar.cpp -@@ -14,7 +14,6 @@ - - #include "llvm/Transforms/Scalar.h" - #include "llvm-c/Initialization.h" --#include "llvm-c/Transforms/Scalar.h" - #include "llvm/Analysis/BasicAliasAnalysis.h" - #include "llvm/Analysis/ScopedNoAliasAA.h" - #include "llvm/Analysis/TypeBasedAliasAnalysis.h" -@@ -97,163 +96,6 @@ void llvm::initializeScalarOpts(PassRegistry &Registry) { - initializeLoopSimplifyCFGLegacyPassPass(Registry); - } - --void LLVMAddLoopSimplifyCFGPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createLoopSimplifyCFGPass()); --} -- - void LLVMInitializeScalarOpts(LLVMPassRegistryRef R) { - initializeScalarOpts(*unwrap(R)); - } -- --void LLVMAddAggressiveDCEPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createAggressiveDCEPass()); --} -- --void LLVMAddDCEPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createDeadCodeEliminationPass()); --} -- --void LLVMAddBitTrackingDCEPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createBitTrackingDCEPass()); --} -- --void LLVMAddAlignmentFromAssumptionsPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createAlignmentFromAssumptionsPass()); --} -- --void LLVMAddCFGSimplificationPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createCFGSimplificationPass()); --} -- --void LLVMAddDeadStoreEliminationPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createDeadStoreEliminationPass()); --} -- --void LLVMAddScalarizerPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createScalarizerPass()); --} -- --void LLVMAddGVNPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createGVNPass()); --} -- --void LLVMAddNewGVNPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createNewGVNPass()); --} -- --void LLVMAddMergedLoadStoreMotionPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createMergedLoadStoreMotionPass()); --} -- --void LLVMAddIndVarSimplifyPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createIndVarSimplifyPass()); --} -- --void LLVMAddInstructionSimplifyPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createInstSimplifyLegacyPass()); --} -- --void LLVMAddJumpThreadingPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createJumpThreadingPass()); --} -- --void LLVMAddLoopSinkPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createLoopSinkPass()); --} -- --void LLVMAddLICMPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createLICMPass()); --} -- --void LLVMAddLoopRotatePass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createLoopRotatePass()); --} -- --void LLVMAddLoopUnrollPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createLoopUnrollPass()); --} -- --void LLVMAddLowerAtomicPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createLowerAtomicPass()); --} -- --void LLVMAddMemCpyOptPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createMemCpyOptPass()); --} -- --void LLVMAddPartiallyInlineLibCallsPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createPartiallyInlineLibCallsPass()); --} -- --void LLVMAddReassociatePass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createReassociatePass()); --} -- --void LLVMAddScalarReplAggregatesPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createSROAPass()); --} -- --void LLVMAddScalarReplAggregatesPassSSA(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createSROAPass()); --} -- --void LLVMAddScalarReplAggregatesPassWithThreshold(LLVMPassManagerRef PM, -- int Threshold) { -- unwrap(PM)->add(createSROAPass()); --} -- --void LLVMAddSimplifyLibCallsPass(LLVMPassManagerRef PM) { -- // NOTE: The simplify-libcalls pass has been removed. --} -- --void LLVMAddTailCallEliminationPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createTailCallEliminationPass()); --} -- --void LLVMAddDemoteMemoryToRegisterPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createDemoteRegisterToMemoryPass()); --} -- --void LLVMAddVerifierPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createVerifierPass()); --} -- --void LLVMAddCorrelatedValuePropagationPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createCorrelatedValuePropagationPass()); --} -- --void LLVMAddEarlyCSEPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createEarlyCSEPass(false/*=UseMemorySSA*/)); --} -- --void LLVMAddEarlyCSEMemSSAPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createEarlyCSEPass(true/*=UseMemorySSA*/)); --} -- --void LLVMAddGVNHoistLegacyPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createGVNHoistPass()); --} -- --void LLVMAddTypeBasedAliasAnalysisPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createTypeBasedAAWrapperPass()); --} -- --void LLVMAddScopedNoAliasAAPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createScopedNoAliasAAWrapperPass()); --} -- --void LLVMAddBasicAliasAnalysisPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createBasicAAWrapperPass()); --} -- --void LLVMAddLowerConstantIntrinsicsPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createLowerConstantIntrinsicsPass()); --} -- --void LLVMAddLowerExpectIntrinsicPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createLowerExpectIntrinsicPass()); --} -- --void LLVMAddUnifyFunctionExitNodesPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createUnifyFunctionExitNodesPass()); --} -diff --git a/llvm/lib/Transforms/Utils/Utils.cpp b/llvm/lib/Transforms/Utils/Utils.cpp -index a20dadb69767..d86f20c7bb6f 100644 ---- a/llvm/lib/Transforms/Utils/Utils.cpp -+++ b/llvm/lib/Transforms/Utils/Utils.cpp -@@ -13,7 +13,6 @@ - - #include "llvm/Transforms/Utils.h" - #include "llvm-c/Initialization.h" --#include "llvm-c/Transforms/Utils.h" - #include "llvm/IR/LegacyPassManager.h" - #include "llvm/InitializePasses.h" - #include "llvm/Pass.h" -@@ -50,15 +49,3 @@ void llvm::initializeTransformUtils(PassRegistry &Registry) { - void LLVMInitializeTransformUtils(LLVMPassRegistryRef R) { - initializeTransformUtils(*unwrap(R)); - } -- --void LLVMAddLowerSwitchPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createLowerSwitchPass()); --} -- --void LLVMAddPromoteMemoryToRegisterPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createPromoteMemoryToRegisterPass()); --} -- --void LLVMAddAddDiscriminatorsPass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createAddDiscriminatorsPass()); --} -diff --git a/llvm/lib/Transforms/Vectorize/Vectorize.cpp b/llvm/lib/Transforms/Vectorize/Vectorize.cpp -index c2060484af5d..6a335e9120bb 100644 ---- a/llvm/lib/Transforms/Vectorize/Vectorize.cpp -+++ b/llvm/lib/Transforms/Vectorize/Vectorize.cpp -@@ -14,7 +14,6 @@ - - #include "llvm/Transforms/Vectorize.h" - #include "llvm-c/Initialization.h" --#include "llvm-c/Transforms/Vectorize.h" - #include "llvm/IR/LegacyPassManager.h" - #include "llvm/InitializePasses.h" - #include "llvm/PassRegistry.h" -@@ -31,11 +30,3 @@ void llvm::initializeVectorization(PassRegistry &Registry) { - void LLVMInitializeVectorization(LLVMPassRegistryRef R) { - initializeVectorization(*unwrap(R)); - } -- --void LLVMAddLoopVectorizePass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createLoopVectorizePass()); --} -- --void LLVMAddSLPVectorizePass(LLVMPassManagerRef PM) { -- unwrap(PM)->add(createSLPVectorizerPass()); --} -diff --git a/llvm/tools/llvm-c-test/include-all.c b/llvm/tools/llvm-c-test/include-all.c -index 69ed753e5068..eada03caf5e0 100644 ---- a/llvm/tools/llvm-c-test/include-all.c -+++ b/llvm/tools/llvm-c-test/include-all.c -@@ -35,11 +35,7 @@ - #include "llvm-c/Support.h" - #include "llvm-c/Target.h" - #include "llvm-c/TargetMachine.h" --#include "llvm-c/Transforms/InstCombine.h" --#include "llvm-c/Transforms/IPO.h" -+#include "llvm-c/Transforms/PassBuilder.h" - #include "llvm-c/Transforms/PassManagerBuilder.h" --#include "llvm-c/Transforms/Scalar.h" --#include "llvm-c/Transforms/Utils.h" --#include "llvm-c/Transforms/Vectorize.h" - #include "llvm-c/Types.h" - #include "llvm-c/lto.h" --- -2.39.2 - diff --git a/0005-llvm-c-Remove-PassManagerBuilder-APIs.patch b/0005-llvm-c-Remove-PassManagerBuilder-APIs.patch deleted file mode 100644 index 599e3a420aae..000000000000 --- a/0005-llvm-c-Remove-PassManagerBuilder-APIs.patch +++ /dev/null @@ -1,239 +0,0 @@ -From 0aac9a2875bad4f065367e4a6553fad78605f895 Mon Sep 17 00:00:00 2001 -From: Nikita Popov <npopov@redhat.com> -Date: Mon, 6 Mar 2023 16:53:35 +0100 -Subject: [PATCH] [llvm-c] Remove PassManagerBuilder APIs - -The legacy PM is only supported for codegen, and PassManagerBuilder -is exclusively about the middle-end optimization pipeline. Drop it. - -Differential Revision: https://reviews.llvm.org/D145387 ---- - llvm/docs/ReleaseNotes.rst | 2 + - .../llvm-c/Transforms/PassManagerBuilder.h | 81 ------------------- - .../llvm/Transforms/IPO/PassManagerBuilder.h | 9 --- - .../lib/Transforms/IPO/PassManagerBuilder.cpp | 66 --------------- - llvm/tools/llvm-c-test/include-all.c | 1 - - 5 files changed, 2 insertions(+), 157 deletions(-) - delete mode 100644 llvm/include/llvm-c/Transforms/PassManagerBuilder.h - -diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst -index c136eb7f8fe7..f6ac66df740a 100644 ---- a/llvm/docs/ReleaseNotes.rst -+++ b/llvm/docs/ReleaseNotes.rst -@@ -147,6 +147,8 @@ Changes to the C API - pointer, has been removed. - * Functions for adding legacy passes like ``LLVMAddInstructionCombiningPass`` - have been removed. -+* Removed ``LLVMPassManagerBuilderRef`` and functions interacting with it. -+ These belonged to the no longer supported legacy pass manager. - - Changes to the FastISel infrastructure - -------------------------------------- -diff --git a/llvm/include/llvm-c/Transforms/PassManagerBuilder.h b/llvm/include/llvm-c/Transforms/PassManagerBuilder.h -deleted file mode 100644 -index 3ba75440129a..000000000000 ---- a/llvm/include/llvm-c/Transforms/PassManagerBuilder.h -+++ /dev/null -@@ -1,81 +0,0 @@ --/*===-- llvm-c/Transform/PassManagerBuilder.h - PMB C Interface ---*- C -*-===*\ --|* *| --|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| --|* Exceptions. *| --|* See https://llvm.org/LICENSE.txt for license information. *| --|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| --|* *| --|*===----------------------------------------------------------------------===*| --|* *| --|* This header declares the C interface to the PassManagerBuilder class. *| --|* *| --\*===----------------------------------------------------------------------===*/ -- --#ifndef LLVM_C_TRANSFORMS_PASSMANAGERBUILDER_H --#define LLVM_C_TRANSFORMS_PASSMANAGERBUILDER_H -- --#include "llvm-c/ExternC.h" --#include "llvm-c/Types.h" -- --typedef struct LLVMOpaquePassManagerBuilder *LLVMPassManagerBuilderRef; -- --LLVM_C_EXTERN_C_BEGIN -- --/** -- * @defgroup LLVMCTransformsPassManagerBuilder Pass manager builder -- * @ingroup LLVMCTransforms -- * -- * @{ -- */ -- --/** See llvm::PassManagerBuilder. */ --LLVMPassManagerBuilderRef LLVMPassManagerBuilderCreate(void); --void LLVMPassManagerBuilderDispose(LLVMPassManagerBuilderRef PMB); -- --/** See llvm::PassManagerBuilder::OptLevel. */ --void --LLVMPassManagerBuilderSetOptLevel(LLVMPassManagerBuilderRef PMB, -- unsigned OptLevel); -- --/** See llvm::PassManagerBuilder::SizeLevel. */ --void --LLVMPassManagerBuilderSetSizeLevel(LLVMPassManagerBuilderRef PMB, -- unsigned SizeLevel); -- --/** See llvm::PassManagerBuilder::DisableUnitAtATime. */ --void --LLVMPassManagerBuilderSetDisableUnitAtATime(LLVMPassManagerBuilderRef PMB, -- LLVMBool Value); -- --/** See llvm::PassManagerBuilder::DisableUnrollLoops. */ --void --LLVMPassManagerBuilderSetDisableUnrollLoops(LLVMPassManagerBuilderRef PMB, -- LLVMBool Value); -- --/** See llvm::PassManagerBuilder::DisableSimplifyLibCalls */ --void --LLVMPassManagerBuilderSetDisableSimplifyLibCalls(LLVMPassManagerBuilderRef PMB, -- LLVMBool Value); -- --/** See llvm::PassManagerBuilder::Inliner. */ --void --LLVMPassManagerBuilderUseInlinerWithThreshold(LLVMPassManagerBuilderRef PMB, -- unsigned Threshold); -- --/** See llvm::PassManagerBuilder::populateFunctionPassManager. */ --void --LLVMPassManagerBuilderPopulateFunctionPassManager(LLVMPassManagerBuilderRef PMB, -- LLVMPassManagerRef PM); -- --/** See llvm::PassManagerBuilder::populateModulePassManager. */ --void --LLVMPassManagerBuilderPopulateModulePassManager(LLVMPassManagerBuilderRef PMB, -- LLVMPassManagerRef PM); -- --/** -- * @} -- */ -- --LLVM_C_EXTERN_C_END -- --#endif -diff --git a/llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h b/llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h -index 3930cb8a0e05..a727ffed33cd 100644 ---- a/llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h -+++ b/llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h -@@ -14,7 +14,6 @@ - #ifndef LLVM_TRANSFORMS_IPO_PASSMANAGERBUILDER_H - #define LLVM_TRANSFORMS_IPO_PASSMANAGERBUILDER_H - --#include "llvm-c/Transforms/PassManagerBuilder.h" - #include <functional> - #include <string> - #include <vector> -@@ -122,13 +121,5 @@ public: - void populateModulePassManager(legacy::PassManagerBase &MPM); - }; - --inline PassManagerBuilder *unwrap(LLVMPassManagerBuilderRef P) { -- return reinterpret_cast<PassManagerBuilder*>(P); --} -- --inline LLVMPassManagerBuilderRef wrap(PassManagerBuilder *P) { -- return reinterpret_cast<LLVMPassManagerBuilderRef>(P); --} -- - } // end namespace llvm - #endif -diff --git a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp -index 5fec9dcbadb3..cd8523c215a0 100644 ---- a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp -+++ b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp -@@ -12,7 +12,6 @@ - //===----------------------------------------------------------------------===// - - #include "llvm/Transforms/IPO/PassManagerBuilder.h" --#include "llvm-c/Transforms/PassManagerBuilder.h" - #include "llvm/ADT/STLExtras.h" - #include "llvm/ADT/SmallVector.h" - #include "llvm/Analysis/GlobalsModRef.h" -@@ -361,68 +360,3 @@ void PassManagerBuilder::populateModulePassManager( - MPM.add(createCFGSimplificationPass( - SimplifyCFGOptions().convertSwitchRangeToICmp(true))); - } -- --LLVMPassManagerBuilderRef LLVMPassManagerBuilderCreate() { -- PassManagerBuilder *PMB = new PassManagerBuilder(); -- return wrap(PMB); --} -- --void LLVMPassManagerBuilderDispose(LLVMPassManagerBuilderRef PMB) { -- PassManagerBuilder *Builder = unwrap(PMB); -- delete Builder; --} -- --void --LLVMPassManagerBuilderSetOptLevel(LLVMPassManagerBuilderRef PMB, -- unsigned OptLevel) { -- PassManagerBuilder *Builder = unwrap(PMB); -- Builder->OptLevel = OptLevel; --} -- --void --LLVMPassManagerBuilderSetSizeLevel(LLVMPassManagerBuilderRef PMB, -- unsigned SizeLevel) { -- PassManagerBuilder *Builder = unwrap(PMB); -- Builder->SizeLevel = SizeLevel; --} -- --void --LLVMPassManagerBuilderSetDisableUnitAtATime(LLVMPassManagerBuilderRef PMB, -- LLVMBool Value) { -- // NOTE: The DisableUnitAtATime switch has been removed. --} -- --void --LLVMPassManagerBuilderSetDisableUnrollLoops(LLVMPassManagerBuilderRef PMB, -- LLVMBool Value) { -- PassManagerBuilder *Builder = unwrap(PMB); -- Builder->DisableUnrollLoops = Value; --} -- --void --LLVMPassManagerBuilderSetDisableSimplifyLibCalls(LLVMPassManagerBuilderRef PMB, -- LLVMBool Value) { -- // NOTE: The simplify-libcalls pass has been removed. --} -- --void --LLVMPassManagerBuilderUseInlinerWithThreshold(LLVMPassManagerBuilderRef PMB, -- unsigned Threshold) { -- // TODO: remove this --} -- --void --LLVMPassManagerBuilderPopulateFunctionPassManager(LLVMPassManagerBuilderRef PMB, -- LLVMPassManagerRef PM) { -- PassManagerBuilder *Builder = unwrap(PMB); -- legacy::FunctionPassManager *FPM = unwrap<legacy::FunctionPassManager>(PM); -- Builder->populateFunctionPassManager(*FPM); --} -- --void --LLVMPassManagerBuilderPopulateModulePassManager(LLVMPassManagerBuilderRef PMB, -- LLVMPassManagerRef PM) { -- PassManagerBuilder *Builder = unwrap(PMB); -- legacy::PassManagerBase *MPM = unwrap(PM); -- Builder->populateModulePassManager(*MPM); --} -diff --git a/llvm/tools/llvm-c-test/include-all.c b/llvm/tools/llvm-c-test/include-all.c -index eada03caf5e0..d5d07ff0b891 100644 ---- a/llvm/tools/llvm-c-test/include-all.c -+++ b/llvm/tools/llvm-c-test/include-all.c -@@ -36,6 +36,5 @@ - #include "llvm-c/Target.h" - #include "llvm-c/TargetMachine.h" - #include "llvm-c/Transforms/PassBuilder.h" --#include "llvm-c/Transforms/PassManagerBuilder.h" - #include "llvm-c/Types.h" - #include "llvm-c/lto.h" --- -2.39.2 - diff --git a/0006-llvm-c-Remove-pointee-support-from-LLVMGetElementTyp.patch b/0006-llvm-c-Remove-pointee-support-from-LLVMGetElementTyp.patch deleted file mode 100644 index c63d58a93c97..000000000000 --- a/0006-llvm-c-Remove-pointee-support-from-LLVMGetElementTyp.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 9e0c2626f3d4282a135da112320139d9fba32fb5 Mon Sep 17 00:00:00 2001 -From: Arthur Eubanks <aeubanks@google.com> -Date: Thu, 9 Mar 2023 15:42:27 -0800 -Subject: [PATCH] [llvm-c] Remove pointee support from LLVMGetElementType - -Reviewed By: nikic - -Differential Revision: https://reviews.llvm.org/D145717 ---- - llvm/docs/ReleaseNotes.rst | 2 ++ - llvm/include/llvm-c/Core.h | 2 -- - llvm/lib/IR/Core.cpp | 2 -- - 3 files changed, 2 insertions(+), 4 deletions(-) - -diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst -index f6ac66df740a..4cf01ad8e284 100644 ---- a/llvm/docs/ReleaseNotes.rst -+++ b/llvm/docs/ReleaseNotes.rst -@@ -149,6 +149,8 @@ Changes to the C API - have been removed. - * Removed ``LLVMPassManagerBuilderRef`` and functions interacting with it. - These belonged to the no longer supported legacy pass manager. -+* As part of the opaque pointer transition, ``LLVMGetElementType`` no longer -+ gives the pointee type of a pointer type. - - Changes to the FastISel infrastructure - -------------------------------------- -diff --git a/llvm/include/llvm-c/Core.h b/llvm/include/llvm-c/Core.h -index df9db59503c3..5454cc2d96c5 100644 ---- a/llvm/include/llvm-c/Core.h -+++ b/llvm/include/llvm-c/Core.h -@@ -1411,8 +1411,6 @@ LLVMBool LLVMIsLiteralStruct(LLVMTypeRef StructTy); - /** - * Obtain the element type of an array or vector type. - * -- * This currently also works for pointer types, but this usage is deprecated. -- * - * @see llvm::SequentialType::getElementType() - */ - LLVMTypeRef LLVMGetElementType(LLVMTypeRef Ty); -diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp -index a0fade96daec..85b7d17ef56c 100644 ---- a/llvm/lib/IR/Core.cpp -+++ b/llvm/lib/IR/Core.cpp -@@ -811,8 +811,6 @@ LLVMTypeRef LLVMScalableVectorType(LLVMTypeRef ElementType, - - LLVMTypeRef LLVMGetElementType(LLVMTypeRef WrappedTy) { - auto *Ty = unwrap(WrappedTy); -- if (auto *PTy = dyn_cast<PointerType>(Ty)) -- return wrap(PTy->getNonOpaquePointerElementType()); - if (auto *ATy = dyn_cast<ArrayType>(Ty)) - return wrap(ATy->getElementType()); - return wrap(cast<VectorType>(Ty)->getElementType()); --- -2.39.2 - diff --git a/0007-Passes-Remove-some-legacy-passes.patch b/0007-Passes-Remove-some-legacy-passes.patch deleted file mode 100644 index 3b0c98f64570..000000000000 --- a/0007-Passes-Remove-some-legacy-passes.patch +++ /dev/null @@ -1,1154 +0,0 @@ -From 7c3c981442b11153ac1a2be678db727ff715253b Mon Sep 17 00:00:00 2001 -From: Arthur Eubanks <aeubanks@google.com> -Date: Wed, 8 Mar 2023 15:07:17 -0800 -Subject: [PATCH] [Passes] Remove some legacy passes - -DFAJumpThreading -JumpThreading -LibCallsShrink -LoopVectorize -SLPVectorizer -DeadStoreElimination -AggressiveDCE -CorrelatedValuePropagation -IndVarSimplify - -These are part of the optimization pipeline, of which the legacy version is deprecated and being removed. ---- - .../LLJITWithOptimizingIRTransform.cpp | 1 - - llvm/include/llvm/InitializePasses.h | 4 - - llvm/include/llvm/LinkAllPasses.h | 9 -- - llvm/include/llvm/Transforms/Scalar.h | 51 ---------- - llvm/include/llvm/Transforms/Vectorize.h | 14 --- - .../lib/Transforms/IPO/PassManagerBuilder.cpp | 19 ---- - llvm/lib/Transforms/Scalar/ADCE.cpp | 47 --------- - .../Scalar/CorrelatedValuePropagation.cpp | 47 --------- - .../Transforms/Scalar/DFAJumpThreading.cpp | 43 -------- - .../Scalar/DeadStoreElimination.cpp | 76 -------------- - llvm/lib/Transforms/Scalar/IndVarSimplify.cpp | 51 ---------- - llvm/lib/Transforms/Scalar/JumpThreading.cpp | 87 ---------------- - llvm/lib/Transforms/Scalar/Scalar.cpp | 6 -- - .../Transforms/Utils/LibCallsShrinkWrap.cpp | 43 -------- - llvm/lib/Transforms/Utils/Utils.cpp | 1 - - .../Transforms/Vectorize/LoopVectorize.cpp | 98 ------------------- - .../Transforms/Vectorize/SLPVectorizer.cpp | 71 -------------- - llvm/lib/Transforms/Vectorize/Vectorize.cpp | 2 - - .../hexagon_vector_loop_carried_reuse.ll | 2 +- - ...n_vector_loop_carried_reuse_commutative.ll | 2 +- - ...agon_vector_loop_carried_reuse_constant.ll | 2 +- - .../scev-after-loopinstsimplify.ll | 2 +- - .../AArch64/sleef-calls-aarch64.ll | 2 +- - polly/lib/Transform/Canonicalization.cpp | 1 - - 24 files changed, 5 insertions(+), 676 deletions(-) - -diff --git a/llvm/examples/OrcV2Examples/LLJITWithOptimizingIRTransform/LLJITWithOptimizingIRTransform.cpp b/llvm/examples/OrcV2Examples/LLJITWithOptimizingIRTransform/LLJITWithOptimizingIRTransform.cpp -index a5fd384b65b5..069c8e8e8031 100644 ---- a/llvm/examples/OrcV2Examples/LLJITWithOptimizingIRTransform/LLJITWithOptimizingIRTransform.cpp -+++ b/llvm/examples/OrcV2Examples/LLJITWithOptimizingIRTransform/LLJITWithOptimizingIRTransform.cpp -@@ -74,7 +74,6 @@ class MyOptimizationTransform { - public: - MyOptimizationTransform() : PM(std::make_unique<legacy::PassManager>()) { - PM->add(createTailCallEliminationPass()); -- PM->add(createIndVarSimplifyPass()); - PM->add(createCFGSimplificationPass()); - } - -diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h -index 818dd2e5c45e..64a9f7b47112 100644 ---- a/llvm/include/llvm/InitializePasses.h -+++ b/llvm/include/llvm/InitializePasses.h -@@ -99,7 +99,6 @@ void initializeCycleInfoWrapperPassPass(PassRegistry &); - void initializeDAEPass(PassRegistry&); - void initializeDAHPass(PassRegistry&); - void initializeDCELegacyPassPass(PassRegistry&); --void initializeDFAJumpThreadingLegacyPassPass(PassRegistry &); - void initializeDSELegacyPassPass(PassRegistry&); - void initializeDeadMachineInstructionElimPass(PassRegistry&); - void initializeDebugifyMachineModulePass(PassRegistry &); -@@ -189,7 +188,6 @@ void initializeLegacyLoopSinkPassPass(PassRegistry&); - void initializeLegalizerPass(PassRegistry&); - void initializeGISelCSEAnalysisWrapperPassPass(PassRegistry &); - void initializeGISelKnownBitsAnalysisPass(PassRegistry &); --void initializeLibCallsShrinkWrapLegacyPassPass(PassRegistry&); - void initializeLintLegacyPassPass(PassRegistry &); - void initializeLiveDebugValuesPass(PassRegistry&); - void initializeLiveDebugVariablesPass(PassRegistry&); -@@ -215,7 +213,6 @@ void initializeLoopSimplifyCFGLegacyPassPass(PassRegistry&); - void initializeLoopSimplifyPass(PassRegistry&); - void initializeLoopStrengthReducePass(PassRegistry&); - void initializeLoopUnrollPass(PassRegistry&); --void initializeLoopVectorizePass(PassRegistry&); - void initializeLowerAtomicLegacyPassPass(PassRegistry&); - void initializeLowerConstantIntrinsicsPass(PassRegistry&); - void initializeLowerEmuTLSPass(PassRegistry&); -@@ -336,7 +333,6 @@ void initializeRewriteStatepointsForGCLegacyPassPass(PassRegistry &); - void initializeRewriteSymbolsLegacyPassPass(PassRegistry&); - void initializeSCCPLegacyPassPass(PassRegistry&); - void initializeSCEVAAWrapperPassPass(PassRegistry&); --void initializeSLPVectorizerPass(PassRegistry&); - void initializeSROALegacyPassPass(PassRegistry&); - void initializeSafeStackLegacyPassPass(PassRegistry&); - void initializeSafepointIRVerifierPass(PassRegistry&); -diff --git a/llvm/include/llvm/LinkAllPasses.h b/llvm/include/llvm/LinkAllPasses.h -index 3f20916af2f3..9e16054bfb9f 100644 ---- a/llvm/include/llvm/LinkAllPasses.h -+++ b/llvm/include/llvm/LinkAllPasses.h -@@ -69,7 +69,6 @@ namespace { - return; - - (void) llvm::createAAEvalPass(); -- (void) llvm::createAggressiveDCEPass(); - (void)llvm::createBitTrackingDCEPass(); - (void) llvm::createAlignmentFromAssumptionsPass(); - (void) llvm::createBasicAAWrapperPass(); -@@ -81,11 +80,9 @@ namespace { - (void) llvm::createCallGraphViewerPass(); - (void) llvm::createCFGSimplificationPass(); - (void) llvm::createStructurizeCFGPass(); -- (void) llvm::createLibCallsShrinkWrapPass(); - (void) llvm::createCostModelAnalysisPass(); - (void) llvm::createDeadArgEliminationPass(); - (void) llvm::createDeadCodeEliminationPass(); -- (void) llvm::createDeadStoreEliminationPass(); - (void) llvm::createDependenceAnalysisWrapperPass(); - (void) llvm::createDomOnlyPrinterWrapperPassPass(); - (void) llvm::createDomPrinterWrapperPassPass(); -@@ -96,7 +93,6 @@ namespace { - (void) llvm::createGuardWideningPass(); - (void) llvm::createLoopGuardWideningPass(); - (void) llvm::createInductiveRangeCheckEliminationPass(); -- (void) llvm::createIndVarSimplifyPass(); - (void) llvm::createInstSimplifyLegacyPass(); - (void) llvm::createInstructionCombiningPass(); - (void) llvm::createJMCInstrumenterPass(); -@@ -137,8 +133,6 @@ namespace { - (void) llvm::createSingleLoopExtractorPass(); - (void) llvm::createTailCallEliminationPass(); - (void)llvm::createTLSVariableHoistPass(); -- (void) llvm::createJumpThreadingPass(); -- (void) llvm::createDFAJumpThreadingPass(); - (void) llvm::createUnifyFunctionExitNodesPass(); - (void) llvm::createInstCountPass(); - (void) llvm::createConstantHoistingPass(); -@@ -164,10 +158,7 @@ namespace { - (void) llvm::createLintLegacyPassPass(); - (void) llvm::createSinkingPass(); - (void) llvm::createLowerAtomicPass(); -- (void) llvm::createCorrelatedValuePropagationPass(); - (void) llvm::createMemDepPrinter(); -- (void) llvm::createLoopVectorizePass(); -- (void) llvm::createSLPVectorizerPass(); - (void) llvm::createLoadStoreVectorizerPass(); - (void) llvm::createPartiallyInlineLibCallsPass(); - (void) llvm::createScalarizerPass(); -diff --git a/llvm/include/llvm/Transforms/Scalar.h b/llvm/include/llvm/Transforms/Scalar.h -index ae91ddca7b81..e9b6dc40c913 100644 ---- a/llvm/include/llvm/Transforms/Scalar.h -+++ b/llvm/include/llvm/Transforms/Scalar.h -@@ -47,13 +47,6 @@ Pass *createRedundantDbgInstEliminationPass(); - // - FunctionPass *createDeadCodeEliminationPass(); - --//===----------------------------------------------------------------------===// --// --// DeadStoreElimination - This pass deletes stores that are post-dominated by --// must-aliased stores and are not loaded used between the stores. --// --FunctionPass *createDeadStoreEliminationPass(); -- - - //===----------------------------------------------------------------------===// - // -@@ -61,14 +54,6 @@ FunctionPass *createDeadStoreEliminationPass(); - // values. - FunctionPass *createCallSiteSplittingPass(); - --//===----------------------------------------------------------------------===// --// --// AggressiveDCE - This pass uses the SSA based Aggressive DCE algorithm. This --// algorithm assumes instructions are dead until proven otherwise, which makes --// it more successful are removing non-obviously dead instructions. --// --FunctionPass *createAggressiveDCEPass(); -- - //===----------------------------------------------------------------------===// - // - // GuardWidening - An optimization over the @llvm.experimental.guard intrinsic -@@ -108,13 +93,6 @@ FunctionPass *createSROAPass(bool PreserveCFG = true); - // - Pass *createInductiveRangeCheckEliminationPass(); - --//===----------------------------------------------------------------------===// --// --// InductionVariableSimplify - Transform induction variables in a program to all --// use a single canonical induction variable per loop. --// --Pass *createIndVarSimplifyPass(); -- - //===----------------------------------------------------------------------===// - // - // LICM - This pass is a loop invariant code motion and memory promotion pass. -@@ -188,22 +166,6 @@ extern char &DemoteRegisterToMemoryID; - // - FunctionPass *createReassociatePass(); - --//===----------------------------------------------------------------------===// --// --// JumpThreading - Thread control through mult-pred/multi-succ blocks where some --// preds always go to some succ. Thresholds other than minus one --// override the internal BB duplication default threshold. --// --FunctionPass *createJumpThreadingPass(int Threshold = -1); -- --//===----------------------------------------------------------------------===// --// --// DFAJumpThreading - When a switch statement inside a loop is used to --// implement a deterministic finite automata we can jump thread the switch --// statement reducing number of conditional jumps. --// --FunctionPass *createDFAJumpThreadingPass(); -- - //===----------------------------------------------------------------------===// - // - // CFGSimplification - Merge basic blocks, eliminate unreachable blocks, -@@ -327,12 +289,6 @@ Pass *createLowerWidenableConditionPass(); - // - Pass *createMergeICmpsLegacyPass(); - --//===----------------------------------------------------------------------===// --// --// ValuePropagation - Propagate CFG-derived value information --// --Pass *createCorrelatedValuePropagationPass(); -- - //===----------------------------------------------------------------------===// - // - // InferAddressSpaces - Modify users of addrspacecast instructions with values -@@ -428,13 +384,6 @@ FunctionPass *createNaryReassociatePass(); - // - FunctionPass *createLoopDataPrefetchPass(); - --//===----------------------------------------------------------------------===// --// --// LibCallsShrinkWrap - Shrink-wraps a call to function if the result is not --// used. --// --FunctionPass *createLibCallsShrinkWrapPass(); -- - //===----------------------------------------------------------------------===// - // - // LoopSimplifyCFG - This pass performs basic CFG simplification on loops, -diff --git a/llvm/include/llvm/Transforms/Vectorize.h b/llvm/include/llvm/Transforms/Vectorize.h -index bca78d073003..b77ebbc55e7d 100644 ---- a/llvm/include/llvm/Transforms/Vectorize.h -+++ b/llvm/include/llvm/Transforms/Vectorize.h -@@ -104,20 +104,6 @@ struct VectorizeConfig { - VectorizeConfig(); - }; - --//===----------------------------------------------------------------------===// --// --// LoopVectorize - Create a loop vectorization pass. --// --Pass *createLoopVectorizePass(); --Pass *createLoopVectorizePass(bool InterleaveOnlyWhenForced, -- bool VectorizeOnlyWhenForced); -- --//===----------------------------------------------------------------------===// --// --// SLPVectorizer - Create a bottom-up SLP vectorizer pass. --// --Pass *createSLPVectorizerPass(); -- - //===----------------------------------------------------------------------===// - /// Vectorize the BasicBlock. - /// -diff --git a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp -index cd8523c215a0..ba7a7f9b121d 100644 ---- a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp -+++ b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp -@@ -102,17 +102,12 @@ void PassManagerBuilder::addFunctionSimplificationPasses( - if (OptLevel > 1) { - // Speculative execution if the target has divergent branches; otherwise nop. - MPM.add(createSpeculativeExecutionIfHasBranchDivergencePass()); -- -- MPM.add(createJumpThreadingPass()); // Thread jumps. -- MPM.add(createCorrelatedValuePropagationPass()); // Propagate conditionals - } - MPM.add( - createCFGSimplificationPass(SimplifyCFGOptions().convertSwitchRangeToICmp( - true))); // Merge & remove BBs - // Combine silly seq's - MPM.add(createInstructionCombiningPass()); -- if (SizeLevel == 0) -- MPM.add(createLibCallsShrinkWrapPass()); - - // TODO: Investigate the cost/benefit of tail call elimination on debugging. - if (OptLevel > 1) -@@ -151,7 +146,6 @@ void PassManagerBuilder::addFunctionSimplificationPasses( - SimplifyCFGOptions().convertSwitchRangeToICmp(true))); - MPM.add(createInstructionCombiningPass()); - // We resume loop passes creating a second loop pipeline here. -- MPM.add(createIndVarSimplifyPass()); // Canonicalize indvars - - // Unroll small loops and perform peeling. - MPM.add(createSimpleLoopUnrollPass(OptLevel, DisableUnrollLoops, -@@ -174,16 +168,10 @@ void PassManagerBuilder::addFunctionSimplificationPasses( - // Run instcombine after redundancy elimination to exploit opportunities - // opened up by them. - MPM.add(createInstructionCombiningPass()); -- if (OptLevel > 1) { -- MPM.add(createJumpThreadingPass()); // Thread jumps -- MPM.add(createCorrelatedValuePropagationPass()); -- } -- MPM.add(createAggressiveDCEPass()); // Delete dead instructions - - MPM.add(createMemCpyOptPass()); // Remove memcpy / form memset - // TODO: Investigate if this is too expensive at O1. - if (OptLevel > 1) { -- MPM.add(createDeadStoreEliminationPass()); // Delete dead stores - MPM.add(createLICMPass(LicmMssaOptCap, LicmMssaNoAccForPromotionCap, - /*AllowSpeculation=*/true)); - } -@@ -198,8 +186,6 @@ void PassManagerBuilder::addFunctionSimplificationPasses( - /// FIXME: Should LTO cause any differences to this set of passes? - void PassManagerBuilder::addVectorPasses(legacy::PassManagerBase &PM, - bool IsFullLTO) { -- PM.add(createLoopVectorizePass(!LoopsInterleaved, !LoopVectorize)); -- - if (IsFullLTO) { - // The vectorizer may have significantly shortened a loop body; unroll - // again. Unroll small loops to hide loop backedge latency and saturate any -@@ -237,11 +223,6 @@ void PassManagerBuilder::addVectorPasses(legacy::PassManagerBase &PM, - PM.add(createBitTrackingDCEPass()); - } - -- // Optimize parallel scalar instruction chains into SIMD instructions. -- if (SLPVectorize) { -- PM.add(createSLPVectorizerPass()); -- } -- - if (!IsFullLTO) { - PM.add(createInstructionCombiningPass()); - -diff --git a/llvm/lib/Transforms/Scalar/ADCE.cpp b/llvm/lib/Transforms/Scalar/ADCE.cpp -index ec07c5341d18..b96feb905659 100644 ---- a/llvm/lib/Transforms/Scalar/ADCE.cpp -+++ b/llvm/lib/Transforms/Scalar/ADCE.cpp -@@ -733,50 +733,3 @@ PreservedAnalyses ADCEPass::run(Function &F, FunctionAnalysisManager &FAM) { - - return PA; - } -- --namespace { -- --struct ADCELegacyPass : public FunctionPass { -- static char ID; // Pass identification, replacement for typeid -- -- ADCELegacyPass() : FunctionPass(ID) { -- initializeADCELegacyPassPass(*PassRegistry::getPassRegistry()); -- } -- -- bool runOnFunction(Function &F) override { -- if (skipFunction(F)) -- return false; -- -- // ADCE does not need DominatorTree, but require DominatorTree here -- // to update analysis if it is already available. -- auto *DTWP = getAnalysisIfAvailable<DominatorTreeWrapperPass>(); -- auto *DT = DTWP ? &DTWP->getDomTree() : nullptr; -- auto &PDT = getAnalysis<PostDominatorTreeWrapperPass>().getPostDomTree(); -- ADCEChanged Changed = -- AggressiveDeadCodeElimination(F, DT, PDT).performDeadCodeElimination(); -- return Changed.ChangedAnything; -- } -- -- void getAnalysisUsage(AnalysisUsage &AU) const override { -- AU.addRequired<PostDominatorTreeWrapperPass>(); -- if (!RemoveControlFlowFlag) -- AU.setPreservesCFG(); -- else { -- AU.addPreserved<DominatorTreeWrapperPass>(); -- AU.addPreserved<PostDominatorTreeWrapperPass>(); -- } -- AU.addPreserved<GlobalsAAWrapperPass>(); -- } --}; -- --} // end anonymous namespace -- --char ADCELegacyPass::ID = 0; -- --INITIALIZE_PASS_BEGIN(ADCELegacyPass, "adce", -- "Aggressive Dead Code Elimination", false, false) --INITIALIZE_PASS_DEPENDENCY(PostDominatorTreeWrapperPass) --INITIALIZE_PASS_END(ADCELegacyPass, "adce", "Aggressive Dead Code Elimination", -- false, false) -- --FunctionPass *llvm::createAggressiveDCEPass() { return new ADCELegacyPass(); } -diff --git a/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp b/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp -index a6293ee67123..1323d724a97c 100644 ---- a/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp -+++ b/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp -@@ -97,43 +97,6 @@ STATISTIC(NumMinMax, "Number of llvm.[us]{min,max} intrinsics removed"); - STATISTIC(NumUDivURemsNarrowedExpanded, - "Number of bound udiv's/urem's expanded"); - --namespace { -- -- class CorrelatedValuePropagation : public FunctionPass { -- public: -- static char ID; -- -- CorrelatedValuePropagation(): FunctionPass(ID) { -- initializeCorrelatedValuePropagationPass(*PassRegistry::getPassRegistry()); -- } -- -- bool runOnFunction(Function &F) override; -- -- void getAnalysisUsage(AnalysisUsage &AU) const override { -- AU.addRequired<DominatorTreeWrapperPass>(); -- AU.addRequired<LazyValueInfoWrapperPass>(); -- AU.addPreserved<GlobalsAAWrapperPass>(); -- AU.addPreserved<DominatorTreeWrapperPass>(); -- AU.addPreserved<LazyValueInfoWrapperPass>(); -- } -- }; -- --} // end anonymous namespace -- --char CorrelatedValuePropagation::ID = 0; -- --INITIALIZE_PASS_BEGIN(CorrelatedValuePropagation, "correlated-propagation", -- "Value Propagation", false, false) --INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass) --INITIALIZE_PASS_DEPENDENCY(LazyValueInfoWrapperPass) --INITIALIZE_PASS_END(CorrelatedValuePropagation, "correlated-propagation", -- "Value Propagation", false, false) -- --// Public interface to the Value Propagation pass --Pass *llvm::createCorrelatedValuePropagationPass() { -- return new CorrelatedValuePropagation(); --} -- - static bool processSelect(SelectInst *S, LazyValueInfo *LVI) { - if (S->getType()->isVectorTy()) return false; - if (isa<Constant>(S->getCondition())) return false; -@@ -1221,16 +1184,6 @@ static bool runImpl(Function &F, LazyValueInfo *LVI, DominatorTree *DT, - return FnChanged; - } - --bool CorrelatedValuePropagation::runOnFunction(Function &F) { -- if (skipFunction(F)) -- return false; -- -- LazyValueInfo *LVI = &getAnalysis<LazyValueInfoWrapperPass>().getLVI(); -- DominatorTree *DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree(); -- -- return runImpl(F, LVI, DT, getBestSimplifyQuery(*this, F)); --} -- - PreservedAnalyses - CorrelatedValuePropagationPass::run(Function &F, FunctionAnalysisManager &AM) { - LazyValueInfo *LVI = &AM.getResult<LazyValueAnalysis>(F); -diff --git a/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp b/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp -index 658d0fcb53fa..ede98fc69e64 100644 ---- a/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp -+++ b/llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp -@@ -168,51 +168,8 @@ private: - OptimizationRemarkEmitter *ORE; - }; - --class DFAJumpThreadingLegacyPass : public FunctionPass { --public: -- static char ID; // Pass identification -- DFAJumpThreadingLegacyPass() : FunctionPass(ID) {} -- -- void getAnalysisUsage(AnalysisUsage &AU) const override { -- AU.addRequired<AssumptionCacheTracker>(); -- AU.addRequired<DominatorTreeWrapperPass>(); -- AU.addPreserved<DominatorTreeWrapperPass>(); -- AU.addRequired<TargetTransformInfoWrapperPass>(); -- AU.addRequired<OptimizationRemarkEmitterWrapperPass>(); -- } -- -- bool runOnFunction(Function &F) override { -- if (skipFunction(F)) -- return false; -- -- AssumptionCache *AC = -- &getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F); -- DominatorTree *DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree(); -- TargetTransformInfo *TTI = -- &getAnalysis<TargetTransformInfoWrapperPass>().getTTI(F); -- OptimizationRemarkEmitter *ORE = -- &getAnalysis<OptimizationRemarkEmitterWrapperPass>().getORE(); -- -- return DFAJumpThreading(AC, DT, TTI, ORE).run(F); -- } --}; - } // end anonymous namespace - --char DFAJumpThreadingLegacyPass::ID = 0; --INITIALIZE_PASS_BEGIN(DFAJumpThreadingLegacyPass, "dfa-jump-threading", -- "DFA Jump Threading", false, false) --INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker) --INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass) --INITIALIZE_PASS_DEPENDENCY(TargetTransformInfoWrapperPass) --INITIALIZE_PASS_DEPENDENCY(OptimizationRemarkEmitterWrapperPass) --INITIALIZE_PASS_END(DFAJumpThreadingLegacyPass, "dfa-jump-threading", -- "DFA Jump Threading", false, false) -- --// Public interface to the DFA Jump Threading pass --FunctionPass *llvm::createDFAJumpThreadingPass() { -- return new DFAJumpThreadingLegacyPass(); --} -- - namespace { - - /// Create a new basic block and sink \p SIToSink into it. -diff --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp -index d3757341ad20..9a7ad8d49222 100644 ---- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp -+++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp -@@ -2240,79 +2240,3 @@ PreservedAnalyses DSEPass::run(Function &F, FunctionAnalysisManager &AM) { - PA.preserve<LoopAnalysis>(); - return PA; - } -- --namespace { -- --/// A legacy pass for the legacy pass manager that wraps \c DSEPass. --class DSELegacyPass : public FunctionPass { --public: -- static char ID; // Pass identification, replacement for typeid -- -- DSELegacyPass() : FunctionPass(ID) { -- initializeDSELegacyPassPass(*PassRegistry::getPassRegistry()); -- } -- -- bool runOnFunction(Function &F) override { -- if (skipFunction(F)) -- return false; -- -- AliasAnalysis &AA = getAnalysis<AAResultsWrapperPass>().getAAResults(); -- DominatorTree &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree(); -- const TargetLibraryInfo &TLI = -- getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(F); -- MemorySSA &MSSA = getAnalysis<MemorySSAWrapperPass>().getMSSA(); -- PostDominatorTree &PDT = -- getAnalysis<PostDominatorTreeWrapperPass>().getPostDomTree(); -- AssumptionCache &AC = -- getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F); -- LoopInfo &LI = getAnalysis<LoopInfoWrapperPass>().getLoopInfo(); -- -- bool Changed = eliminateDeadStores(F, AA, MSSA, DT, PDT, AC, TLI, LI); -- --#ifdef LLVM_ENABLE_STATS -- if (AreStatisticsEnabled()) -- for (auto &I : instructions(F)) -- NumRemainingStores += isa<StoreInst>(&I); --#endif -- -- return Changed; -- } -- -- void getAnalysisUsage(AnalysisUsage &AU) const override { -- AU.setPreservesCFG(); -- AU.addRequired<AAResultsWrapperPass>(); -- AU.addRequired<TargetLibraryInfoWrapperPass>(); -- AU.addPreserved<GlobalsAAWrapperPass>(); -- AU.addRequired<DominatorTreeWrapperPass>(); -- AU.addPreserved<DominatorTreeWrapperPass>(); -- AU.addRequired<PostDominatorTreeWrapperPass>(); -- AU.addRequired<MemorySSAWrapperPass>(); -- AU.addPreserved<PostDominatorTreeWrapperPass>(); -- AU.addPreserved<MemorySSAWrapperPass>(); -- AU.addRequired<LoopInfoWrapperPass>(); -- AU.addPreserved<LoopInfoWrapperPass>(); -- AU.addRequired<AssumptionCacheTracker>(); -- } --}; -- --} // end anonymous namespace -- --char DSELegacyPass::ID = 0; -- --INITIALIZE_PASS_BEGIN(DSELegacyPass, "dse", "Dead Store Elimination", false, -- false) --INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass) --INITIALIZE_PASS_DEPENDENCY(PostDominatorTreeWrapperPass) --INITIALIZE_PASS_DEPENDENCY(AAResultsWrapperPass) --INITIALIZE_PASS_DEPENDENCY(GlobalsAAWrapperPass) --INITIALIZE_PASS_DEPENDENCY(MemorySSAWrapperPass) --INITIALIZE_PASS_DEPENDENCY(MemoryDependenceWrapperPass) --INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass) --INITIALIZE_PASS_DEPENDENCY(LoopInfoWrapperPass) --INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker) --INITIALIZE_PASS_END(DSELegacyPass, "dse", "Dead Store Elimination", false, -- false) -- --FunctionPass *llvm::createDeadStoreEliminationPass() { -- return new DSELegacyPass(); --} -diff --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp -index 0c21ae26297d..64f5dcb94312 100644 ---- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp -+++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp -@@ -2223,54 +2223,3 @@ PreservedAnalyses IndVarSimplifyPass::run(Loop &L, LoopAnalysisManager &AM, - PA.preserve<MemorySSAAnalysis>(); - return PA; - } -- --namespace { -- --struct IndVarSimplifyLegacyPass : public LoopPass { -- static char ID; // Pass identification, replacement for typeid -- -- IndVarSimplifyLegacyPass() : LoopPass(ID) { -- initializeIndVarSimplifyLegacyPassPass(*PassRegistry::getPassRegistry()); -- } -- -- bool runOnLoop(Loop *L, LPPassManager &LPM) override { -- if (skipLoop(L)) -- return false; -- -- auto *LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo(); -- auto *SE = &getAnalysis<ScalarEvolutionWrapperPass>().getSE(); -- auto *DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree(); -- auto *TLIP = getAnalysisIfAvailable<TargetLibraryInfoWrapperPass>(); -- auto *TLI = TLIP ? &TLIP->getTLI(*L->getHeader()->getParent()) : nullptr; -- auto *TTIP = getAnalysisIfAvailable<TargetTransformInfoWrapperPass>(); -- auto *TTI = TTIP ? &TTIP->getTTI(*L->getHeader()->getParent()) : nullptr; -- const DataLayout &DL = L->getHeader()->getModule()->getDataLayout(); -- auto *MSSAAnalysis = getAnalysisIfAvailable<MemorySSAWrapperPass>(); -- MemorySSA *MSSA = nullptr; -- if (MSSAAnalysis) -- MSSA = &MSSAAnalysis->getMSSA(); -- -- IndVarSimplify IVS(LI, SE, DT, DL, TLI, TTI, MSSA, AllowIVWidening); -- return IVS.run(L); -- } -- -- void getAnalysisUsage(AnalysisUsage &AU) const override { -- AU.setPreservesCFG(); -- AU.addPreserved<MemorySSAWrapperPass>(); -- getLoopAnalysisUsage(AU); -- } --}; -- --} // end anonymous namespace -- --char IndVarSimplifyLegacyPass::ID = 0; -- --INITIALIZE_PASS_BEGIN(IndVarSimplifyLegacyPass, "indvars", -- "Induction Variable Simplification", false, false) --INITIALIZE_PASS_DEPENDENCY(LoopPass) --INITIALIZE_PASS_END(IndVarSimplifyLegacyPass, "indvars", -- "Induction Variable Simplification", false, false) -- --Pass *llvm::createIndVarSimplifyPass() { -- return new IndVarSimplifyLegacyPass(); --} -diff --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/llvm/lib/Transforms/Scalar/JumpThreading.cpp -index eac41f05ca14..35daa8f3874d 100644 ---- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp -+++ b/llvm/lib/Transforms/Scalar/JumpThreading.cpp -@@ -115,64 +115,6 @@ static cl::opt<bool> ThreadAcrossLoopHeaders( - cl::desc("Allow JumpThreading to thread across loop headers, for testing"), - cl::init(false), cl::Hidden); - -- --namespace { -- -- /// This pass performs 'jump threading', which looks at blocks that have -- /// multiple predecessors and multiple successors. If one or more of the -- /// predecessors of the block can be proven to always jump to one of the -- /// successors, we forward the edge from the predecessor to the successor by -- /// duplicating the contents of this block. -- /// -- /// An example of when this can occur is code like this: -- /// -- /// if () { ... -- /// X = 4; -- /// } -- /// if (X < 3) { -- /// -- /// In this case, the unconditional branch at the end of the first if can be -- /// revectored to the false side of the second if. -- class JumpThreading : public FunctionPass { -- public: -- static char ID; // Pass identification -- -- JumpThreading(int T = -1) : FunctionPass(ID) { -- initializeJumpThreadingPass(*PassRegistry::getPassRegistry()); -- } -- -- bool runOnFunction(Function &F) override; -- -- void getAnalysisUsage(AnalysisUsage &AU) const override { -- AU.addRequired<DominatorTreeWrapperPass>(); -- AU.addPreserved<DominatorTreeWrapperPass>(); -- AU.addRequired<AAResultsWrapperPass>(); -- AU.addRequired<LazyValueInfoWrapperPass>(); -- AU.addPreserved<LazyValueInfoWrapperPass>(); -- AU.addPreserved<GlobalsAAWrapperPass>(); -- AU.addRequired<TargetLibraryInfoWrapperPass>(); -- AU.addRequired<TargetTransformInfoWrapperPass>(); -- } -- }; -- --} // end anonymous namespace -- --char JumpThreading::ID = 0; -- --INITIALIZE_PASS_BEGIN(JumpThreading, "jump-threading", -- "Jump Threading", false, false) --INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass) --INITIALIZE_PASS_DEPENDENCY(LazyValueInfoWrapperPass) --INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass) --INITIALIZE_PASS_DEPENDENCY(AAResultsWrapperPass) --INITIALIZE_PASS_END(JumpThreading, "jump-threading", -- "Jump Threading", false, false) -- --// Public interface to the Jump Threading pass --FunctionPass *llvm::createJumpThreadingPass(int Threshold) { -- return new JumpThreading(Threshold); --} -- - JumpThreadingPass::JumpThreadingPass(int T) { - DefaultBBDupThreshold = (T == -1) ? BBDuplicateThreshold : unsigned(T); - } -@@ -303,35 +245,6 @@ static void updatePredecessorProfileMetadata(PHINode *PN, BasicBlock *BB) { - } - } - --/// runOnFunction - Toplevel algorithm. --bool JumpThreading::runOnFunction(Function &F) { -- if (skipFunction(F)) -- return false; -- auto TTI = &getAnalysis<TargetTransformInfoWrapperPass>().getTTI(F); -- // Jump Threading has no sense for the targets with divergent CF -- if (TTI->hasBranchDivergence()) -- return false; -- auto TLI = &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(F); -- auto DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree(); -- auto LVI = &getAnalysis<LazyValueInfoWrapperPass>().getLVI(); -- auto AA = &getAnalysis<AAResultsWrapperPass>().getAAResults(); -- -- LoopInfo LI{*DT}; -- auto BPI = std::make_unique<BranchProbabilityInfo>(F, LI, TLI); -- auto BFI = std::make_unique<BlockFrequencyInfo>(F, *BPI, LI); -- -- JumpThreadingPass Impl; -- bool Changed = Impl.runImpl(F, nullptr, TLI, TTI, LVI, AA, -- std::make_unique<DomTreeUpdater>( -- DT, DomTreeUpdater::UpdateStrategy::Lazy), -- BFI.get(), BPI.get()); -- if (PrintLVIAfterJumpThreading) { -- dbgs() << "LVI for function '" << F.getName() << "':\n"; -- LVI->printLVI(F, Impl.getDomTreeUpdater()->getDomTree(), dbgs()); -- } -- return Changed; --} -- - PreservedAnalyses JumpThreadingPass::run(Function &F, - FunctionAnalysisManager &AM) { - auto &TTI = AM.getResult<TargetIRAnalysis>(F); -diff --git a/llvm/lib/Transforms/Scalar/Scalar.cpp b/llvm/lib/Transforms/Scalar/Scalar.cpp -index 9a3d243859be..26a1e22f3317 100644 ---- a/llvm/lib/Transforms/Scalar/Scalar.cpp -+++ b/llvm/lib/Transforms/Scalar/Scalar.cpp -@@ -29,15 +29,12 @@ using namespace llvm; - /// initializeScalarOptsPasses - Initialize all passes linked into the - /// ScalarOpts library. - void llvm::initializeScalarOpts(PassRegistry &Registry) { -- initializeADCELegacyPassPass(Registry); - initializeBDCELegacyPassPass(Registry); - initializeAlignmentFromAssumptionsPass(Registry); - initializeCallSiteSplittingLegacyPassPass(Registry); - initializeConstantHoistingLegacyPassPass(Registry); -- initializeCorrelatedValuePropagationPass(Registry); - initializeDCELegacyPassPass(Registry); - initializeScalarizerLegacyPassPass(Registry); -- initializeDSELegacyPassPass(Registry); - initializeGuardWideningLegacyPassPass(Registry); - initializeLoopGuardWideningLegacyPassPass(Registry); - initializeGVNLegacyPassPass(Registry); -@@ -49,11 +46,8 @@ void llvm::initializeScalarOpts(PassRegistry &Registry) { - initializeGVNSinkLegacyPassPass(Registry); - initializeFlattenCFGLegacyPassPass(Registry); - initializeIRCELegacyPassPass(Registry); -- initializeIndVarSimplifyLegacyPassPass(Registry); - initializeInferAddressSpacesPass(Registry); - initializeInstSimplifyLegacyPassPass(Registry); -- initializeJumpThreadingPass(Registry); -- initializeDFAJumpThreadingLegacyPassPass(Registry); - initializeLegacyLICMPassPass(Registry); - initializeLegacyLoopSinkPassPass(Registry); - initializeLoopDataPrefetchLegacyPassPass(Registry); -diff --git a/llvm/lib/Transforms/Utils/LibCallsShrinkWrap.cpp b/llvm/lib/Transforms/Utils/LibCallsShrinkWrap.cpp -index 5dd469c7af4b..ff2d5a017590 100644 ---- a/llvm/lib/Transforms/Utils/LibCallsShrinkWrap.cpp -+++ b/llvm/lib/Transforms/Utils/LibCallsShrinkWrap.cpp -@@ -50,27 +50,6 @@ using namespace llvm; - STATISTIC(NumWrappedOneCond, "Number of One-Condition Wrappers Inserted"); - STATISTIC(NumWrappedTwoCond, "Number of Two-Condition Wrappers Inserted"); - --namespace { --class LibCallsShrinkWrapLegacyPass : public FunctionPass { --public: -- static char ID; // Pass identification, replacement for typeid -- explicit LibCallsShrinkWrapLegacyPass() : FunctionPass(ID) { -- initializeLibCallsShrinkWrapLegacyPassPass( -- *PassRegistry::getPassRegistry()); -- } -- void getAnalysisUsage(AnalysisUsage &AU) const override; -- bool runOnFunction(Function &F) override; --}; --} -- --char LibCallsShrinkWrapLegacyPass::ID = 0; --INITIALIZE_PASS_BEGIN(LibCallsShrinkWrapLegacyPass, "libcalls-shrinkwrap", -- "Conditionally eliminate dead library calls", false, -- false) --INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass) --INITIALIZE_PASS_END(LibCallsShrinkWrapLegacyPass, "libcalls-shrinkwrap", -- "Conditionally eliminate dead library calls", false, false) -- - namespace { - class LibCallsShrinkWrap : public InstVisitor<LibCallsShrinkWrap> { - public: -@@ -515,12 +494,6 @@ bool LibCallsShrinkWrap::perform(CallInst *CI) { - return performCallErrors(CI, Func); - } - --void LibCallsShrinkWrapLegacyPass::getAnalysisUsage(AnalysisUsage &AU) const { -- AU.addPreserved<DominatorTreeWrapperPass>(); -- AU.addPreserved<GlobalsAAWrapperPass>(); -- AU.addRequired<TargetLibraryInfoWrapperPass>(); --} -- - static bool runImpl(Function &F, const TargetLibraryInfo &TLI, - DominatorTree *DT) { - if (F.hasFnAttribute(Attribute::OptimizeForSize)) -@@ -534,21 +507,6 @@ static bool runImpl(Function &F, const TargetLibraryInfo &TLI, - return Changed; - } - --bool LibCallsShrinkWrapLegacyPass::runOnFunction(Function &F) { -- auto &TLI = getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(F); -- auto *DTWP = getAnalysisIfAvailable<DominatorTreeWrapperPass>(); -- auto *DT = DTWP ? &DTWP->getDomTree() : nullptr; -- return runImpl(F, TLI, DT); --} -- --namespace llvm { --char &LibCallsShrinkWrapPassID = LibCallsShrinkWrapLegacyPass::ID; -- --// Public interface to LibCallsShrinkWrap pass. --FunctionPass *createLibCallsShrinkWrapPass() { -- return new LibCallsShrinkWrapLegacyPass(); --} -- - PreservedAnalyses LibCallsShrinkWrapPass::run(Function &F, - FunctionAnalysisManager &FAM) { - auto &TLI = FAM.getResult<TargetLibraryAnalysis>(F); -@@ -559,4 +517,3 @@ PreservedAnalyses LibCallsShrinkWrapPass::run(Function &F, - PA.preserve<DominatorTreeAnalysis>(); - return PA; - } --} -diff --git a/llvm/lib/Transforms/Utils/Utils.cpp b/llvm/lib/Transforms/Utils/Utils.cpp -index d86f20c7bb6f..59d1b8e42dc1 100644 ---- a/llvm/lib/Transforms/Utils/Utils.cpp -+++ b/llvm/lib/Transforms/Utils/Utils.cpp -@@ -30,7 +30,6 @@ void llvm::initializeTransformUtils(PassRegistry &Registry) { - initializeCanonicalizeFreezeInLoopsPass(Registry); - initializeInstNamerPass(Registry); - initializeLCSSAWrapperPassPass(Registry); -- initializeLibCallsShrinkWrapLegacyPassPass(Registry); - initializeLoopSimplifyPass(Registry); - initializeLowerGlobalDtorsLegacyPassPass(Registry); - initializeLowerInvokeLegacyPassPass(Registry); -diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp -index 9083b7b3c712..df6f3b33fac0 100644 ---- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp -+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp -@@ -2250,73 +2250,6 @@ static void collectSupportedLoops(Loop &L, LoopInfo *LI, - collectSupportedLoops(*InnerL, LI, ORE, V); - } - --namespace { -- --/// The LoopVectorize Pass. --struct LoopVectorize : public FunctionPass { -- /// Pass identification, replacement for typeid -- static char ID; -- -- LoopVectorizePass Impl; -- -- explicit LoopVectorize(bool InterleaveOnlyWhenForced = false, -- bool VectorizeOnlyWhenForced = false) -- : FunctionPass(ID), -- Impl({InterleaveOnlyWhenForced, VectorizeOnlyWhenForced}) { -- initializeLoopVectorizePass(*PassRegistry::getPassRegistry()); -- } -- -- bool runOnFunction(Function &F) override { -- if (skipFunction(F)) -- return false; -- -- auto *SE = &getAnalysis<ScalarEvolutionWrapperPass>().getSE(); -- auto *LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo(); -- auto *TTI = &getAnalysis<TargetTransformInfoWrapperPass>().getTTI(F); -- auto *DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree(); -- auto *BFI = &getAnalysis<BlockFrequencyInfoWrapperPass>().getBFI(); -- auto *TLIP = getAnalysisIfAvailable<TargetLibraryInfoWrapperPass>(); -- auto *TLI = TLIP ? &TLIP->getTLI(F) : nullptr; -- auto *AC = &getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F); -- auto &LAIs = getAnalysis<LoopAccessLegacyAnalysis>().getLAIs(); -- auto *DB = &getAnalysis<DemandedBitsWrapperPass>().getDemandedBits(); -- auto *ORE = &getAnalysis<OptimizationRemarkEmitterWrapperPass>().getORE(); -- auto *PSI = &getAnalysis<ProfileSummaryInfoWrapperPass>().getPSI(); -- -- return Impl -- .runImpl(F, *SE, *LI, *TTI, *DT, BFI, TLI, *DB, *AC, LAIs, *ORE, PSI) -- .MadeAnyChange; -- } -- -- void getAnalysisUsage(AnalysisUsage &AU) const override { -- AU.addRequired<AssumptionCacheTracker>(); -- AU.addRequired<BlockFrequencyInfoWrapperPass>(); -- AU.addRequired<DominatorTreeWrapperPass>(); -- AU.addRequired<LoopInfoWrapperPass>(); -- AU.addRequired<ScalarEvolutionWrapperPass>(); -- AU.addRequired<TargetTransformInfoWrapperPass>(); -- AU.addRequired<LoopAccessLegacyAnalysis>(); -- AU.addRequired<DemandedBitsWrapperPass>(); -- AU.addRequired<OptimizationRemarkEmitterWrapperPass>(); -- AU.addRequired<InjectTLIMappingsLegacy>(); -- -- // We currently do not preserve loopinfo/dominator analyses with outer loop -- // vectorization. Until this is addressed, mark these analyses as preserved -- // only for non-VPlan-native path. -- // TODO: Preserve Loop and Dominator analyses for VPlan-native path. -- if (!EnableVPlanNativePath) { -- AU.addPreserved<LoopInfoWrapperPass>(); -- AU.addPreserved<DominatorTreeWrapperPass>(); -- } -- -- AU.addPreserved<BasicAAWrapperPass>(); -- AU.addPreserved<GlobalsAAWrapperPass>(); -- AU.addRequired<ProfileSummaryInfoWrapperPass>(); -- } --}; -- --} // end anonymous namespace -- - //===----------------------------------------------------------------------===// - // Implementation of LoopVectorizationLegality, InnerLoopVectorizer and - // LoopVectorizationCostModel and LoopVectorizationPlanner. -@@ -7463,37 +7396,6 @@ LoopVectorizationCostModel::getInstructionCost(Instruction *I, ElementCount VF, - } // end of switch. - } - --char LoopVectorize::ID = 0; -- --static const char lv_name[] = "Loop Vectorization"; -- --INITIALIZE_PASS_BEGIN(LoopVectorize, LV_NAME, lv_name, false, false) --INITIALIZE_PASS_DEPENDENCY(TargetTransformInfoWrapperPass) --INITIALIZE_PASS_DEPENDENCY(BasicAAWrapperPass) --INITIALIZE_PASS_DEPENDENCY(GlobalsAAWrapperPass) --INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker) --INITIALIZE_PASS_DEPENDENCY(BlockFrequencyInfoWrapperPass) --INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass) --INITIALIZE_PASS_DEPENDENCY(ScalarEvolutionWrapperPass) --INITIALIZE_PASS_DEPENDENCY(LoopInfoWrapperPass) --INITIALIZE_PASS_DEPENDENCY(LoopAccessLegacyAnalysis) --INITIALIZE_PASS_DEPENDENCY(DemandedBitsWrapperPass) --INITIALIZE_PASS_DEPENDENCY(OptimizationRemarkEmitterWrapperPass) --INITIALIZE_PASS_DEPENDENCY(ProfileSummaryInfoWrapperPass) --INITIALIZE_PASS_DEPENDENCY(InjectTLIMappingsLegacy) --INITIALIZE_PASS_END(LoopVectorize, LV_NAME, lv_name, false, false) -- --namespace llvm { -- --Pass *createLoopVectorizePass() { return new LoopVectorize(); } -- --Pass *createLoopVectorizePass(bool InterleaveOnlyWhenForced, -- bool VectorizeOnlyWhenForced) { -- return new LoopVectorize(InterleaveOnlyWhenForced, VectorizeOnlyWhenForced); --} -- --} // end namespace llvm -- - void LoopVectorizationCostModel::collectValuesToIgnore() { - // Ignore ephemeral values. - CodeMetrics::collectEphemeralValues(TheLoop, AC, ValuesToIgnore); -diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp -index bbaccb5cd282..91d99e5008cc 100644 ---- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp -+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp -@@ -11645,60 +11645,6 @@ void BoUpSLP::computeMinimumValueSizes() { - MinBWs[Scalar] = std::make_pair(MaxBitWidth, !IsKnownPositive); - } - --namespace { -- --/// The SLPVectorizer Pass. --struct SLPVectorizer : public FunctionPass { -- SLPVectorizerPass Impl; -- -- /// Pass identification, replacement for typeid -- static char ID; -- -- explicit SLPVectorizer() : FunctionPass(ID) { -- initializeSLPVectorizerPass(*PassRegistry::getPassRegistry()); -- } -- -- bool doInitialization(Module &M) override { return false; } -- -- bool runOnFunction(Function &F) override { -- if (skipFunction(F)) -- return false; -- -- auto *SE = &getAnalysis<ScalarEvolutionWrapperPass>().getSE(); -- auto *TTI = &getAnalysis<TargetTransformInfoWrapperPass>().getTTI(F); -- auto *TLIP = getAnalysisIfAvailable<TargetLibraryInfoWrapperPass>(); -- auto *TLI = TLIP ? &TLIP->getTLI(F) : nullptr; -- auto *AA = &getAnalysis<AAResultsWrapperPass>().getAAResults(); -- auto *LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo(); -- auto *DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree(); -- auto *AC = &getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F); -- auto *DB = &getAnalysis<DemandedBitsWrapperPass>().getDemandedBits(); -- auto *ORE = &getAnalysis<OptimizationRemarkEmitterWrapperPass>().getORE(); -- -- return Impl.runImpl(F, SE, TTI, TLI, AA, LI, DT, AC, DB, ORE); -- } -- -- void getAnalysisUsage(AnalysisUsage &AU) const override { -- FunctionPass::getAnalysisUsage(AU); -- AU.addRequired<AssumptionCacheTracker>(); -- AU.addRequired<ScalarEvolutionWrapperPass>(); -- AU.addRequired<AAResultsWrapperPass>(); -- AU.addRequired<TargetTransformInfoWrapperPass>(); -- AU.addRequired<LoopInfoWrapperPass>(); -- AU.addRequired<DominatorTreeWrapperPass>(); -- AU.addRequired<DemandedBitsWrapperPass>(); -- AU.addRequired<OptimizationRemarkEmitterWrapperPass>(); -- AU.addRequired<InjectTLIMappingsLegacy>(); -- AU.addPreserved<LoopInfoWrapperPass>(); -- AU.addPreserved<DominatorTreeWrapperPass>(); -- AU.addPreserved<AAResultsWrapperPass>(); -- AU.addPreserved<GlobalsAAWrapperPass>(); -- AU.setPreservesCFG(); -- } --}; -- --} // end anonymous namespace -- - PreservedAnalyses SLPVectorizerPass::run(Function &F, FunctionAnalysisManager &AM) { - auto *SE = &AM.getResult<ScalarEvolutionAnalysis>(F); - auto *TTI = &AM.getResult<TargetIRAnalysis>(F); -@@ -14600,20 +14546,3 @@ bool SLPVectorizerPass::vectorizeStoreChains(BoUpSLP &R) { - } - return Changed; - } -- --char SLPVectorizer::ID = 0; -- --static const char lv_name[] = "SLP Vectorizer"; -- --INITIALIZE_PASS_BEGIN(SLPVectorizer, SV_NAME, lv_name, false, false) --INITIALIZE_PASS_DEPENDENCY(AAResultsWrapperPass) --INITIALIZE_PASS_DEPENDENCY(TargetTransformInfoWrapperPass) --INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker) --INITIALIZE_PASS_DEPENDENCY(ScalarEvolutionWrapperPass) --INITIALIZE_PASS_DEPENDENCY(LoopSimplify) --INITIALIZE_PASS_DEPENDENCY(DemandedBitsWrapperPass) --INITIALIZE_PASS_DEPENDENCY(OptimizationRemarkEmitterWrapperPass) --INITIALIZE_PASS_DEPENDENCY(InjectTLIMappingsLegacy) --INITIALIZE_PASS_END(SLPVectorizer, SV_NAME, lv_name, false, false) -- --Pass *llvm::createSLPVectorizerPass() { return new SLPVectorizer(); } -diff --git a/llvm/lib/Transforms/Vectorize/Vectorize.cpp b/llvm/lib/Transforms/Vectorize/Vectorize.cpp -index 6a335e9120bb..cea47334d507 100644 ---- a/llvm/lib/Transforms/Vectorize/Vectorize.cpp -+++ b/llvm/lib/Transforms/Vectorize/Vectorize.cpp -@@ -22,8 +22,6 @@ using namespace llvm; - - /// Initialize all passes linked into the Vectorization library. - void llvm::initializeVectorization(PassRegistry &Registry) { -- initializeLoopVectorizePass(Registry); -- initializeSLPVectorizerPass(Registry); - initializeLoadStoreVectorizerLegacyPassPass(Registry); - } - -diff --git a/llvm/test/CodeGen/Hexagon/hexagon_vector_loop_carried_reuse.ll b/llvm/test/CodeGen/Hexagon/hexagon_vector_loop_carried_reuse.ll -index d7b18ae078ff..0771fda02cfb 100644 ---- a/llvm/test/CodeGen/Hexagon/hexagon_vector_loop_carried_reuse.ll -+++ b/llvm/test/CodeGen/Hexagon/hexagon_vector_loop_carried_reuse.ll -@@ -1,4 +1,4 @@ --; RUN: opt < %s -hexagon-vlcr -adce -S | FileCheck %s -+; RUN: opt < %s -hexagon-vlcr | opt -passes=adce -S | FileCheck %s - - ; CHECK: %.hexagon.vlcr = tail call <32 x i32> @llvm.hexagon.V6.vmaxub.128B - ; ModuleID = 'hexagon_vector_loop_carried_reuse.c' -diff --git a/llvm/test/CodeGen/Hexagon/hexagon_vector_loop_carried_reuse_commutative.ll b/llvm/test/CodeGen/Hexagon/hexagon_vector_loop_carried_reuse_commutative.ll -index b280830d403a..25afb9f1a137 100644 ---- a/llvm/test/CodeGen/Hexagon/hexagon_vector_loop_carried_reuse_commutative.ll -+++ b/llvm/test/CodeGen/Hexagon/hexagon_vector_loop_carried_reuse_commutative.ll -@@ -1,4 +1,4 @@ --; RUN: opt -march=hexagon < %s -hexagon-vlcr -adce -S | FileCheck %s -+; RUN: opt < %s -march=hexagon -hexagon-vlcr | opt -passes=adce -S | FileCheck %s - - ; CHECK: %v32.hexagon.vlcr = tail call <32 x i32> @llvm.hexagon.V6.vmaxub.128B - -diff --git a/llvm/test/CodeGen/Hexagon/hexagon_vector_loop_carried_reuse_constant.ll b/llvm/test/CodeGen/Hexagon/hexagon_vector_loop_carried_reuse_constant.ll -index c64404f97775..53973423732c 100644 ---- a/llvm/test/CodeGen/Hexagon/hexagon_vector_loop_carried_reuse_constant.ll -+++ b/llvm/test/CodeGen/Hexagon/hexagon_vector_loop_carried_reuse_constant.ll -@@ -1,4 +1,4 @@ --; RUN: opt < %s -hexagon-vlcr -adce -S | FileCheck %s -+; RUN: opt < %s -hexagon-vlcr | opt -passes=adce -S | FileCheck %s - - ; CHECK-NOT: %.hexagon.vlcr - ; ModuleID = 'hexagon_vector_loop_carried_reuse.c' -diff --git a/llvm/test/Transforms/LoopStrengthReduce/scev-after-loopinstsimplify.ll b/llvm/test/Transforms/LoopStrengthReduce/scev-after-loopinstsimplify.ll -index 6c91f643e7a9..6e059b5d8fa5 100644 ---- a/llvm/test/Transforms/LoopStrengthReduce/scev-after-loopinstsimplify.ll -+++ b/llvm/test/Transforms/LoopStrengthReduce/scev-after-loopinstsimplify.ll -@@ -1,4 +1,4 @@ --; RUN: opt %s -indvars -loop-instsimplify -loop-reduce -+; RUN: opt %s -passes=indvars,loop-instsimplify,loop-reduce - ; We are only checking that there is no crash! - - ; https://bugs.llvm.org/show_bug.cgi?id=37936 -diff --git a/llvm/test/Transforms/LoopVectorize/AArch64/sleef-calls-aarch64.ll b/llvm/test/Transforms/LoopVectorize/AArch64/sleef-calls-aarch64.ll -index ed9e1b4b6fb2..be4309996fbb 100644 ---- a/llvm/test/Transforms/LoopVectorize/AArch64/sleef-calls-aarch64.ll -+++ b/llvm/test/Transforms/LoopVectorize/AArch64/sleef-calls-aarch64.ll -@@ -1,5 +1,5 @@ - ; Do NOT use -O3. It will lower exp2 to ldexp, and the test will fail. --; RUN: opt -vector-library=sleefgnuabi -replace-with-veclib -loop-unroll -loop-vectorize -S < %s | FileCheck %s -+; RUN: opt -vector-library=sleefgnuabi -replace-with-veclib < %s | opt -vector-library=sleefgnuabi -passes=inject-tli-mappings,loop-unroll,loop-vectorize -S | FileCheck %s - - target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" - target triple = "aarch64-unknown-linux-gnu" -diff --git a/polly/lib/Transform/Canonicalization.cpp b/polly/lib/Transform/Canonicalization.cpp -index 8cb235f94601..901299d8f02c 100644 ---- a/polly/lib/Transform/Canonicalization.cpp -+++ b/polly/lib/Transform/Canonicalization.cpp -@@ -56,7 +56,6 @@ void polly::registerCanonicalicationPasses(llvm::legacy::PassManagerBase &PM) { - PM.add(createBarrierNoopPass()); - } - PM.add(llvm::createInstructionCombiningPass()); -- PM.add(llvm::createIndVarSimplifyPass()); - } - - /// Adapted from llvm::PassBuilder::buildInlinerPipeline --- -2.39.2 - diff --git a/0008-PassManagerBuilder-Remove-PassManagerBuilder.patch b/0008-PassManagerBuilder-Remove-PassManagerBuilder.patch deleted file mode 100644 index e199859ee81b..000000000000 --- a/0008-PassManagerBuilder-Remove-PassManagerBuilder.patch +++ /dev/null @@ -1,634 +0,0 @@ -From d623b2f95fd559901f008a0588dddd0949a8db01 Mon Sep 17 00:00:00 2001 -From: Arthur Eubanks <aeubanks@google.com> -Date: Fri, 10 Mar 2023 17:24:19 -0800 -Subject: [PATCH] [PassManagerBuilder] Remove PassManagerBuilder - -PassManagerBuilder is dead, long live PassBuilder! - -bugpoint's -O# are now useless (and probably have been for a while given the number of passes we've removed from PassManagerBuilder). Perhaps they'll be revived if bugpoint ever works with the new PM. - -Reviewed By: nikic, MaskRay - -Differential Revision: https://reviews.llvm.org/D145835 ---- - llvm/docs/WritingAnLLVMPass.rst | 1 - - .../llvm/Transforms/IPO/PassManagerBuilder.h | 125 ------- - llvm/lib/Transforms/IPO/CMakeLists.txt | 1 - - .../lib/Transforms/IPO/PassManagerBuilder.cpp | 343 ------------------ - llvm/tools/bugpoint/bugpoint.cpp | 47 --- - .../llvm/lib/Transforms/IPO/BUILD.gn | 1 - - polly/lib/Support/RegisterPasses.cpp | 1 - - 7 files changed, 519 deletions(-) - delete mode 100644 llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h - delete mode 100644 llvm/lib/Transforms/IPO/PassManagerBuilder.cpp - -diff --git a/llvm/docs/WritingAnLLVMPass.rst b/llvm/docs/WritingAnLLVMPass.rst -index 771185614a49..1e92be87e2e9 100644 ---- a/llvm/docs/WritingAnLLVMPass.rst -+++ b/llvm/docs/WritingAnLLVMPass.rst -@@ -194,7 +194,6 @@ As a whole, the ``.cpp`` file looks like: - #include "llvm/Support/raw_ostream.h" - - #include "llvm/IR/LegacyPassManager.h" -- #include "llvm/Transforms/IPO/PassManagerBuilder.h" - - using namespace llvm; - -diff --git a/llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h b/llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h -deleted file mode 100644 -index a727ffed33cd..000000000000 ---- a/llvm/include/llvm/Transforms/IPO/PassManagerBuilder.h -+++ /dev/null -@@ -1,125 +0,0 @@ --// llvm/Transforms/IPO/PassManagerBuilder.h - Build Standard Pass -*- C++ -*-=// --// --// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. --// See https://llvm.org/LICENSE.txt for license information. --// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception --// --//===----------------------------------------------------------------------===// --// --// This file defines the PassManagerBuilder class, which is used to set up a --// "standard" optimization sequence suitable for languages like C and C++. --// --//===----------------------------------------------------------------------===// -- --#ifndef LLVM_TRANSFORMS_IPO_PASSMANAGERBUILDER_H --#define LLVM_TRANSFORMS_IPO_PASSMANAGERBUILDER_H -- --#include <functional> --#include <string> --#include <vector> -- --namespace llvm { --class ModuleSummaryIndex; --class Pass; --class TargetLibraryInfoImpl; -- --// The old pass manager infrastructure is hidden in a legacy namespace now. --namespace legacy { --class FunctionPassManager; --class PassManagerBase; --} -- --/// PassManagerBuilder - This class is used to set up a standard optimization --/// sequence for languages like C and C++, allowing some APIs to customize the --/// pass sequence in various ways. A simple example of using it would be: --/// --/// PassManagerBuilder Builder; --/// Builder.OptLevel = 2; --/// Builder.populateFunctionPassManager(FPM); --/// Builder.populateModulePassManager(MPM); --/// --/// In addition to setting up the basic passes, PassManagerBuilder allows --/// frontends to vend a plugin API, where plugins are allowed to add extensions --/// to the default pass manager. They do this by specifying where in the pass --/// pipeline they want to be added, along with a callback function that adds --/// the pass(es). For example, a plugin that wanted to add a loop optimization --/// could do something like this: --/// --/// static void addMyLoopPass(const PMBuilder &Builder, PassManagerBase &PM) { --/// if (Builder.getOptLevel() > 2 && Builder.getOptSizeLevel() == 0) --/// PM.add(createMyAwesomePass()); --/// } --/// ... --/// Builder.addExtension(PassManagerBuilder::EP_LoopOptimizerEnd, --/// addMyLoopPass); --/// ... --class PassManagerBuilder { --public: -- /// Extensions are passed to the builder itself (so they can see how it is -- /// configured) as well as the pass manager to add stuff to. -- typedef std::function<void(const PassManagerBuilder &Builder, -- legacy::PassManagerBase &PM)> -- ExtensionFn; -- typedef int GlobalExtensionID; -- -- /// The Optimization Level - Specify the basic optimization level. -- /// 0 = -O0, 1 = -O1, 2 = -O2, 3 = -O3 -- unsigned OptLevel; -- -- /// SizeLevel - How much we're optimizing for size. -- /// 0 = none, 1 = -Os, 2 = -Oz -- unsigned SizeLevel; -- -- /// LibraryInfo - Specifies information about the runtime library for the -- /// optimizer. If this is non-null, it is added to both the function and -- /// per-module pass pipeline. -- TargetLibraryInfoImpl *LibraryInfo; -- -- /// Inliner - Specifies the inliner to use. If this is non-null, it is -- /// added to the per-module passes. -- Pass *Inliner; -- -- /// The module summary index to use for exporting information from the -- /// regular LTO phase, for example for the CFI and devirtualization type -- /// tests. -- ModuleSummaryIndex *ExportSummary = nullptr; -- -- /// The module summary index to use for importing information to the -- /// thin LTO backends, for example for the CFI and devirtualization type -- /// tests. -- const ModuleSummaryIndex *ImportSummary = nullptr; -- -- bool DisableUnrollLoops; -- bool CallGraphProfile; -- bool SLPVectorize; -- bool LoopVectorize; -- bool LoopsInterleaved; -- bool DisableGVNLoadPRE; -- bool ForgetAllSCEVInLoopUnroll; -- bool VerifyInput; -- bool VerifyOutput; -- bool DivergentTarget; -- unsigned LicmMssaOptCap; -- unsigned LicmMssaNoAccForPromotionCap; -- --public: -- PassManagerBuilder(); -- ~PassManagerBuilder(); -- --private: -- void addInitialAliasAnalysisPasses(legacy::PassManagerBase &PM) const; -- void addFunctionSimplificationPasses(legacy::PassManagerBase &MPM); -- void addVectorPasses(legacy::PassManagerBase &PM, bool IsFullLTO); -- --public: -- /// populateFunctionPassManager - This fills in the function pass manager, -- /// which is expected to be run on each function immediately as it is -- /// generated. The idea is to reduce the size of the IR in memory. -- void populateFunctionPassManager(legacy::FunctionPassManager &FPM); -- -- /// populateModulePassManager - This sets up the primary pass manager. -- void populateModulePassManager(legacy::PassManagerBase &MPM); --}; -- --} // end namespace llvm --#endif -diff --git a/llvm/lib/Transforms/IPO/CMakeLists.txt b/llvm/lib/Transforms/IPO/CMakeLists.txt -index 34a1e4c3ebc0..063a9a60d0cb 100644 ---- a/llvm/lib/Transforms/IPO/CMakeLists.txt -+++ b/llvm/lib/Transforms/IPO/CMakeLists.txt -@@ -31,7 +31,6 @@ add_llvm_component_library(LLVMipo - ModuleInliner.cpp - OpenMPOpt.cpp - PartialInlining.cpp -- PassManagerBuilder.cpp - SampleContextTracker.cpp - SampleProfile.cpp - SampleProfileProbe.cpp -diff --git a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp -deleted file mode 100644 -index ba7a7f9b121d..000000000000 ---- a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp -+++ /dev/null -@@ -1,343 +0,0 @@ --//===- PassManagerBuilder.cpp - Build Standard Pass -----------------------===// --// --// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. --// See https://llvm.org/LICENSE.txt for license information. --// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception --// --//===----------------------------------------------------------------------===// --// --// This file defines the PassManagerBuilder class, which is used to set up a --// "standard" optimization sequence suitable for languages like C and C++. --// --//===----------------------------------------------------------------------===// -- --#include "llvm/Transforms/IPO/PassManagerBuilder.h" --#include "llvm/ADT/STLExtras.h" --#include "llvm/ADT/SmallVector.h" --#include "llvm/Analysis/GlobalsModRef.h" --#include "llvm/Analysis/ScopedNoAliasAA.h" --#include "llvm/Analysis/TargetLibraryInfo.h" --#include "llvm/Analysis/TypeBasedAliasAnalysis.h" --#include "llvm/IR/LegacyPassManager.h" --#include "llvm/Support/CommandLine.h" --#include "llvm/Support/ManagedStatic.h" --#include "llvm/Target/CGPassBuilderOption.h" --#include "llvm/Transforms/AggressiveInstCombine/AggressiveInstCombine.h" --#include "llvm/Transforms/IPO.h" --#include "llvm/Transforms/IPO/Attributor.h" --#include "llvm/Transforms/IPO/ForceFunctionAttrs.h" --#include "llvm/Transforms/IPO/FunctionAttrs.h" --#include "llvm/Transforms/IPO/InferFunctionAttrs.h" --#include "llvm/Transforms/InstCombine/InstCombine.h" --#include "llvm/Transforms/Instrumentation.h" --#include "llvm/Transforms/Scalar.h" --#include "llvm/Transforms/Scalar/GVN.h" --#include "llvm/Transforms/Scalar/LICM.h" --#include "llvm/Transforms/Scalar/LoopUnrollPass.h" --#include "llvm/Transforms/Scalar/SimpleLoopUnswitch.h" --#include "llvm/Transforms/Utils.h" --#include "llvm/Transforms/Vectorize.h" -- --using namespace llvm; -- --PassManagerBuilder::PassManagerBuilder() { -- OptLevel = 2; -- SizeLevel = 0; -- LibraryInfo = nullptr; -- Inliner = nullptr; -- DisableUnrollLoops = false; -- SLPVectorize = false; -- LoopVectorize = true; -- LoopsInterleaved = true; -- LicmMssaOptCap = SetLicmMssaOptCap; -- LicmMssaNoAccForPromotionCap = SetLicmMssaNoAccForPromotionCap; -- DisableGVNLoadPRE = false; -- ForgetAllSCEVInLoopUnroll = ForgetSCEVInLoopUnroll; -- VerifyInput = false; -- VerifyOutput = false; -- DivergentTarget = false; -- CallGraphProfile = true; --} -- --PassManagerBuilder::~PassManagerBuilder() { -- delete LibraryInfo; -- delete Inliner; --} -- --void PassManagerBuilder::addInitialAliasAnalysisPasses( -- legacy::PassManagerBase &PM) const { -- // Add TypeBasedAliasAnalysis before BasicAliasAnalysis so that -- // BasicAliasAnalysis wins if they disagree. This is intended to help -- // support "obvious" type-punning idioms. -- PM.add(createTypeBasedAAWrapperPass()); -- PM.add(createScopedNoAliasAAWrapperPass()); --} -- --void PassManagerBuilder::populateFunctionPassManager( -- legacy::FunctionPassManager &FPM) { -- // Add LibraryInfo if we have some. -- if (LibraryInfo) -- FPM.add(new TargetLibraryInfoWrapperPass(*LibraryInfo)); -- -- if (OptLevel == 0) return; -- -- addInitialAliasAnalysisPasses(FPM); -- -- // Lower llvm.expect to metadata before attempting transforms. -- // Compare/branch metadata may alter the behavior of passes like SimplifyCFG. -- FPM.add(createLowerExpectIntrinsicPass()); -- FPM.add(createCFGSimplificationPass()); -- FPM.add(createSROAPass()); -- FPM.add(createEarlyCSEPass()); --} -- --void PassManagerBuilder::addFunctionSimplificationPasses( -- legacy::PassManagerBase &MPM) { -- // Start of function pass. -- // Break up aggregate allocas, using SSAUpdater. -- assert(OptLevel >= 1 && "Calling function optimizer with no optimization level!"); -- MPM.add(createSROAPass()); -- MPM.add(createEarlyCSEPass(true /* Enable mem-ssa. */)); // Catch trivial redundancies -- -- if (OptLevel > 1) { -- // Speculative execution if the target has divergent branches; otherwise nop. -- MPM.add(createSpeculativeExecutionIfHasBranchDivergencePass()); -- } -- MPM.add( -- createCFGSimplificationPass(SimplifyCFGOptions().convertSwitchRangeToICmp( -- true))); // Merge & remove BBs -- // Combine silly seq's -- MPM.add(createInstructionCombiningPass()); -- -- // TODO: Investigate the cost/benefit of tail call elimination on debugging. -- if (OptLevel > 1) -- MPM.add(createTailCallEliminationPass()); // Eliminate tail calls -- MPM.add( -- createCFGSimplificationPass(SimplifyCFGOptions().convertSwitchRangeToICmp( -- true))); // Merge & remove BBs -- MPM.add(createReassociatePass()); // Reassociate expressions -- -- // Begin the loop pass pipeline. -- -- // The simple loop unswitch pass relies on separate cleanup passes. Schedule -- // them first so when we re-process a loop they run before other loop -- // passes. -- MPM.add(createLoopInstSimplifyPass()); -- MPM.add(createLoopSimplifyCFGPass()); -- -- // Try to remove as much code from the loop header as possible, -- // to reduce amount of IR that will have to be duplicated. However, -- // do not perform speculative hoisting the first time as LICM -- // will destroy metadata that may not need to be destroyed if run -- // after loop rotation. -- // TODO: Investigate promotion cap for O1. -- MPM.add(createLICMPass(LicmMssaOptCap, LicmMssaNoAccForPromotionCap, -- /*AllowSpeculation=*/false)); -- // Rotate Loop - disable header duplication at -Oz -- MPM.add(createLoopRotatePass(SizeLevel == 2 ? 0 : -1, false)); -- // TODO: Investigate promotion cap for O1. -- MPM.add(createLICMPass(LicmMssaOptCap, LicmMssaNoAccForPromotionCap, -- /*AllowSpeculation=*/true)); -- MPM.add(createSimpleLoopUnswitchLegacyPass(OptLevel == 3)); -- // FIXME: We break the loop pass pipeline here in order to do full -- // simplifycfg. Eventually loop-simplifycfg should be enhanced to replace the -- // need for this. -- MPM.add(createCFGSimplificationPass( -- SimplifyCFGOptions().convertSwitchRangeToICmp(true))); -- MPM.add(createInstructionCombiningPass()); -- // We resume loop passes creating a second loop pipeline here. -- -- // Unroll small loops and perform peeling. -- MPM.add(createSimpleLoopUnrollPass(OptLevel, DisableUnrollLoops, -- ForgetAllSCEVInLoopUnroll)); -- // This ends the loop pass pipelines. -- -- // Break up allocas that may now be splittable after loop unrolling. -- MPM.add(createSROAPass()); -- -- if (OptLevel > 1) { -- MPM.add(createMergedLoadStoreMotionPass()); // Merge ld/st in diamonds -- MPM.add(createGVNPass(DisableGVNLoadPRE)); // Remove redundancies -- } -- -- // Delete dead bit computations (instcombine runs after to fold away the dead -- // computations, and then ADCE will run later to exploit any new DCE -- // opportunities that creates). -- MPM.add(createBitTrackingDCEPass()); // Delete dead bit computations -- -- // Run instcombine after redundancy elimination to exploit opportunities -- // opened up by them. -- MPM.add(createInstructionCombiningPass()); -- -- MPM.add(createMemCpyOptPass()); // Remove memcpy / form memset -- // TODO: Investigate if this is too expensive at O1. -- if (OptLevel > 1) { -- MPM.add(createLICMPass(LicmMssaOptCap, LicmMssaNoAccForPromotionCap, -- /*AllowSpeculation=*/true)); -- } -- -- // Merge & remove BBs and sink & hoist common instructions. -- MPM.add(createCFGSimplificationPass( -- SimplifyCFGOptions().hoistCommonInsts(true).sinkCommonInsts(true))); -- // Clean up after everything. -- MPM.add(createInstructionCombiningPass()); --} -- --/// FIXME: Should LTO cause any differences to this set of passes? --void PassManagerBuilder::addVectorPasses(legacy::PassManagerBase &PM, -- bool IsFullLTO) { -- if (IsFullLTO) { -- // The vectorizer may have significantly shortened a loop body; unroll -- // again. Unroll small loops to hide loop backedge latency and saturate any -- // parallel execution resources of an out-of-order processor. We also then -- // need to clean up redundancies and loop invariant code. -- // FIXME: It would be really good to use a loop-integrated instruction -- // combiner for cleanup here so that the unrolling and LICM can be pipelined -- // across the loop nests. -- PM.add(createLoopUnrollPass(OptLevel, DisableUnrollLoops, -- ForgetAllSCEVInLoopUnroll)); -- } -- -- // Cleanup after the loop optimization passes. -- PM.add(createInstructionCombiningPass()); -- -- // Now that we've formed fast to execute loop structures, we do further -- // optimizations. These are run afterward as they might block doing complex -- // analyses and transforms such as what are needed for loop vectorization. -- -- // Cleanup after loop vectorization, etc. Simplification passes like CVP and -- // GVN, loop transforms, and others have already run, so it's now better to -- // convert to more optimized IR using more aggressive simplify CFG options. -- // The extra sinking transform can create larger basic blocks, so do this -- // before SLP vectorization. -- PM.add(createCFGSimplificationPass(SimplifyCFGOptions() -- .forwardSwitchCondToPhi(true) -- .convertSwitchRangeToICmp(true) -- .convertSwitchToLookupTable(true) -- .needCanonicalLoops(false) -- .hoistCommonInsts(true) -- .sinkCommonInsts(true))); -- -- if (IsFullLTO) { -- PM.add(createInstructionCombiningPass()); // Clean up again -- PM.add(createBitTrackingDCEPass()); -- } -- -- if (!IsFullLTO) { -- PM.add(createInstructionCombiningPass()); -- -- // Unroll small loops -- PM.add(createLoopUnrollPass(OptLevel, DisableUnrollLoops, -- ForgetAllSCEVInLoopUnroll)); -- -- if (!DisableUnrollLoops) { -- // LoopUnroll may generate some redundency to cleanup. -- PM.add(createInstructionCombiningPass()); -- -- // Runtime unrolling will introduce runtime check in loop prologue. If the -- // unrolled loop is a inner loop, then the prologue will be inside the -- // outer loop. LICM pass can help to promote the runtime check out if the -- // checked value is loop invariant. -- PM.add(createLICMPass(LicmMssaOptCap, LicmMssaNoAccForPromotionCap, -- /*AllowSpeculation=*/true)); -- } -- } -- -- // After vectorization and unrolling, assume intrinsics may tell us more -- // about pointer alignments. -- PM.add(createAlignmentFromAssumptionsPass()); -- -- if (IsFullLTO) -- PM.add(createInstructionCombiningPass()); --} -- --void PassManagerBuilder::populateModulePassManager( -- legacy::PassManagerBase &MPM) { -- // If all optimizations are disabled, just run the always-inline pass and, -- // if enabled, the function merging pass. -- if (OptLevel == 0) { -- if (Inliner) { -- MPM.add(Inliner); -- Inliner = nullptr; -- } -- -- return; -- } -- -- // Add LibraryInfo if we have some. -- if (LibraryInfo) -- MPM.add(new TargetLibraryInfoWrapperPass(*LibraryInfo)); -- -- addInitialAliasAnalysisPasses(MPM); -- -- if (OptLevel > 2) -- MPM.add(createCallSiteSplittingPass()); -- -- // Promote any localized global vars. -- MPM.add(createPromoteMemoryToRegisterPass()); -- -- MPM.add(createDeadArgEliminationPass()); // Dead argument elimination -- -- MPM.add(createInstructionCombiningPass()); // Clean up after IPCP & DAE -- MPM.add( -- createCFGSimplificationPass(SimplifyCFGOptions().convertSwitchRangeToICmp( -- true))); // Clean up after IPCP & DAE -- -- // We add a module alias analysis pass here. In part due to bugs in the -- // analysis infrastructure this "works" in that the analysis stays alive -- // for the entire SCC pass run below. -- MPM.add(createGlobalsAAWrapperPass()); -- -- // Start of CallGraph SCC passes. -- if (Inliner) { -- MPM.add(Inliner); -- Inliner = nullptr; -- } -- -- addFunctionSimplificationPasses(MPM); -- -- // FIXME: This is a HACK! The inliner pass above implicitly creates a CGSCC -- // pass manager that we are specifically trying to avoid. To prevent this -- // we must insert a no-op module pass to reset the pass manager. -- MPM.add(createBarrierNoopPass()); -- -- // We add a fresh GlobalsModRef run at this point. This is particularly -- // useful as the above will have inlined, DCE'ed, and function-attr -- // propagated everything. We should at this point have a reasonably minimal -- // and richly annotated call graph. By computing aliasing and mod/ref -- // information for all local globals here, the late loop passes and notably -- // the vectorizer will be able to use them to help recognize vectorizable -- // memory operations. -- // -- // Note that this relies on a bug in the pass manager which preserves -- // a module analysis into a function pass pipeline (and throughout it) so -- // long as the first function pass doesn't invalidate the module analysis. -- // Thus both Float2Int and LoopRotate have to preserve AliasAnalysis for -- // this to work. Fortunately, it is trivial to preserve AliasAnalysis -- // (doing nothing preserves it as it is required to be conservatively -- // correct in the face of IR changes). -- MPM.add(createGlobalsAAWrapperPass()); -- -- MPM.add(createFloat2IntPass()); -- MPM.add(createLowerConstantIntrinsicsPass()); -- -- // Re-rotate loops in all our loop nests. These may have fallout out of -- // rotated form due to GVN or other transformations, and the vectorizer relies -- // on the rotated form. Disable header duplication at -Oz. -- MPM.add(createLoopRotatePass(SizeLevel == 2 ? 0 : -1, false)); -- -- addVectorPasses(MPM, /* IsFullLTO */ false); -- -- // LoopSink pass sinks instructions hoisted by LICM, which serves as a -- // canonicalization pass that enables other optimizations. As a result, -- // LoopSink pass needs to be a very late IR pass to avoid undoing LICM -- // result too early. -- MPM.add(createLoopSinkPass()); -- // Get rid of LCSSA nodes. -- MPM.add(createInstSimplifyLegacyPass()); -- -- // LoopSink (and other loop passes since the last simplifyCFG) might have -- // resulted in single-entry-single-exit or empty blocks. Clean up the CFG. -- MPM.add(createCFGSimplificationPass( -- SimplifyCFGOptions().convertSwitchRangeToICmp(true))); --} -diff --git a/llvm/tools/bugpoint/bugpoint.cpp b/llvm/tools/bugpoint/bugpoint.cpp -index 42d3395c73b1..e49efdfe7c8e 100644 ---- a/llvm/tools/bugpoint/bugpoint.cpp -+++ b/llvm/tools/bugpoint/bugpoint.cpp -@@ -30,7 +30,6 @@ - #include "llvm/Support/TargetSelect.h" - #include "llvm/Support/Valgrind.h" - #include "llvm/Transforms/IPO/AlwaysInliner.h" --#include "llvm/Transforms/IPO/PassManagerBuilder.h" - - // Enable this macro to debug bugpoint itself. - //#define DEBUG_BUGPOINT 1 -@@ -66,24 +65,6 @@ static cl::opt<bool> - static cl::list<const PassInfo *, bool, PassNameParser> - PassList(cl::desc("Passes available:")); - --static cl::opt<bool> -- OptLevelO1("O1", cl::desc("Optimization level 1. Identical to 'opt -O1'")); -- --static cl::opt<bool> -- OptLevelO2("O2", cl::desc("Optimization level 2. Identical to 'opt -O2'")); -- --static cl::opt<bool> OptLevelOs( -- "Os", -- cl::desc( -- "Like -O2 with extra optimizations for size. Similar to clang -Os")); -- --static cl::opt<bool> --OptLevelOz("Oz", -- cl::desc("Like -Os but reduces code size further. Similar to clang -Oz")); -- --static cl::opt<bool> -- OptLevelO3("O3", cl::desc("Optimization level 3. Identical to 'opt -O3'")); -- - static cl::opt<std::string> - OverrideTriple("mtriple", cl::desc("Override target triple for module")); - -@@ -110,23 +91,6 @@ public: - }; - } - --// This routine adds optimization passes based on selected optimization level, --// OptLevel. --// --// OptLevel - Optimization Level --static void AddOptimizationPasses(legacy::FunctionPassManager &FPM, -- unsigned OptLevel, -- unsigned SizeLevel) { -- PassManagerBuilder Builder; -- Builder.OptLevel = OptLevel; -- Builder.SizeLevel = SizeLevel; -- -- Builder.Inliner = createAlwaysInlinerLegacyPass(); -- -- Builder.populateFunctionPassManager(FPM); -- Builder.populateModulePassManager(FPM); --} -- - #define HANDLE_EXTENSION(Ext) \ - llvm::PassPluginLibraryInfo get##Ext##PluginInfo(); - #include "llvm/Support/Extension.def" -@@ -192,17 +156,6 @@ int main(int argc, char **argv) { - - AddToDriver PM(D); - -- if (OptLevelO1) -- AddOptimizationPasses(PM, 1, 0); -- else if (OptLevelO2) -- AddOptimizationPasses(PM, 2, 0); -- else if (OptLevelO3) -- AddOptimizationPasses(PM, 3, 0); -- else if (OptLevelOs) -- AddOptimizationPasses(PM, 2, 1); -- else if (OptLevelOz) -- AddOptimizationPasses(PM, 2, 2); -- - for (const PassInfo *PI : PassList) - D.addPass(std::string(PI->getPassArgument())); - -diff --git a/llvm/utils/gn/secondary/llvm/lib/Transforms/IPO/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/Transforms/IPO/BUILD.gn -index e960be0f3fd6..644d30f10854 100644 ---- a/llvm/utils/gn/secondary/llvm/lib/Transforms/IPO/BUILD.gn -+++ b/llvm/utils/gn/secondary/llvm/lib/Transforms/IPO/BUILD.gn -@@ -52,7 +52,6 @@ static_library("IPO") { - "ModuleInliner.cpp", - "OpenMPOpt.cpp", - "PartialInlining.cpp", -- "PassManagerBuilder.cpp", - "SCCP.cpp", - "SampleContextTracker.cpp", - "SampleProfile.cpp", -diff --git a/polly/lib/Support/RegisterPasses.cpp b/polly/lib/Support/RegisterPasses.cpp -index 09ccd67d3118..34570f0c83c5 100644 ---- a/polly/lib/Support/RegisterPasses.cpp -+++ b/polly/lib/Support/RegisterPasses.cpp -@@ -48,7 +48,6 @@ - #include "llvm/Support/CommandLine.h" - #include "llvm/Support/TargetSelect.h" - #include "llvm/Transforms/IPO.h" --#include "llvm/Transforms/IPO/PassManagerBuilder.h" - - namespace cl = llvm::cl; - --- -2.39.2 - diff --git a/0009-ConstExpr-Remove-select-constant-expression.patch b/0009-ConstExpr-Remove-select-constant-expression.patch deleted file mode 100644 index 1ec5cbdf21de..000000000000 --- a/0009-ConstExpr-Remove-select-constant-expression.patch +++ /dev/null @@ -1,1021 +0,0 @@ -From bbfb13a5ffbccf1759ca6b75262a3ffdbe20496e Mon Sep 17 00:00:00 2001 -From: Nikita Popov <npopov@redhat.com> -Date: Mon, 6 Mar 2023 10:46:22 +0100 -Subject: [PATCH] [ConstExpr] Remove select constant expression - -This removes the select constant expression, as part of -https://discourse.llvm.org/t/rfc-remove-most-constant-expressions/63179. -Uses of this expressions have already been removed in advance, -so this just removes related infrastructure and updates tests. - -Differential Revision: https://reviews.llvm.org/D145382 ---- - llvm/bindings/ocaml/llvm/llvm.ml | 2 - - llvm/bindings/ocaml/llvm/llvm.mli | 5 -- - llvm/bindings/ocaml/llvm/llvm_ocaml.c | 7 --- - llvm/docs/ReleaseNotes.rst | 11 ++++ - llvm/include/llvm-c/Core.h | 3 - - llvm/include/llvm/IR/Constants.h | 6 -- - llvm/lib/AsmParser/LLParser.cpp | 12 +--- - llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 11 ++-- - llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | 6 -- - llvm/lib/IR/ConstantFold.cpp | 11 ---- - llvm/lib/IR/Constants.cpp | 23 -------- - llvm/lib/IR/ConstantsContext.h | 33 ----------- - llvm/lib/IR/Core.cpp | 8 --- - .../Transforms/Scalar/InferAddressSpaces.cpp | 12 ---- - .../ScalarEvolution/logical-operations.ll | 7 ++- - llvm/test/Assembler/ConstantExprFoldSelect.ll | 8 +-- - llvm/test/Bindings/OCaml/core.ml | 5 -- - llvm/test/Bitcode/select.ll | 18 ------ - ...thinlto-function-summary-callgraph-cast.ll | 4 +- - llvm/test/Bitcode/vscale-round-trip.ll | 8 +-- - .../GlobalISel/irtranslator-constantexpr.ll | 37 ------------ - llvm/test/CodeGen/Generic/pr33094.ll | 6 +- - .../CodeGen/PowerPC/ext-bool-trunc-repl.ll | 23 +++++--- - llvm/test/CodeGen/PowerPC/pr24636.ll | 15 ++++- - llvm/test/CodeGen/WebAssembly/call.ll | 7 ++- - .../CodeGen/X86/2008-09-19-RegAllocBug.ll | 9 +-- - llvm/test/CodeGen/X86/no-plt.ll | 3 +- - llvm/test/CodeGen/X86/pr44749.ll | 10 ++-- - .../ThinLTO/X86/funcattrs-prop-unknown.ll | 2 +- - .../AMDGPU/infer-address-space.ll | 6 +- - .../InferAddressSpaces/AMDGPU/select.ll | 58 ------------------- - .../InstCombine/2010-03-03-ExtElim.ll | 11 +++- - llvm/test/Transforms/InstCombine/cast.ll | 3 +- - llvm/test/Transforms/InstCombine/pr28725.ll | 3 +- - .../InstSimplify/ConstProp/constant-expr.ll | 9 --- - llvm/test/Transforms/InstSimplify/pr28725.ll | 6 +- - llvm/unittests/Analysis/ValueTrackingTest.cpp | 5 +- - llvm/unittests/IR/ConstantsTest.cpp | 2 - - 38 files changed, 108 insertions(+), 307 deletions(-) - delete mode 100644 llvm/test/Bitcode/select.ll - -diff --git a/llvm/bindings/ocaml/llvm/llvm.ml b/llvm/bindings/ocaml/llvm/llvm.ml -index 6962dce737d2..77de9a6e46fa 100644 ---- a/llvm/bindings/ocaml/llvm/llvm.ml -+++ b/llvm/bindings/ocaml/llvm/llvm.ml -@@ -685,8 +685,6 @@ external const_pointercast : llvalue -> lltype -> llvalue - external const_intcast : llvalue -> lltype -> is_signed:bool -> llvalue - = "llvm_const_intcast" - external const_fpcast : llvalue -> lltype -> llvalue = "llvm_const_fpcast" --external const_select : llvalue -> llvalue -> llvalue -> llvalue -- = "llvm_const_select" - external const_extractelement : llvalue -> llvalue -> llvalue - = "llvm_const_extractelement" - external const_insertelement : llvalue -> llvalue -> llvalue -> llvalue -diff --git a/llvm/bindings/ocaml/llvm/llvm.mli b/llvm/bindings/ocaml/llvm/llvm.mli -index 59ac5b855130..9c8b3b883e14 100644 ---- a/llvm/bindings/ocaml/llvm/llvm.mli -+++ b/llvm/bindings/ocaml/llvm/llvm.mli -@@ -1268,11 +1268,6 @@ val const_intcast : llvalue -> lltype -> is_signed:bool -> llvalue - See the method [llvm::ConstantExpr::getFPCast]. *) - val const_fpcast : llvalue -> lltype -> llvalue - --(** [const_select cond t f] returns the constant conditional which returns value -- [t] if the boolean constant [cond] is true and the value [f] otherwise. -- See the method [llvm::ConstantExpr::getSelect]. *) --val const_select : llvalue -> llvalue -> llvalue -> llvalue -- - (** [const_extractelement vec i] returns the constant [i]th element of - constant vector [vec]. [i] must be a constant [i32] value unsigned less than - the size of the vector. -diff --git a/llvm/bindings/ocaml/llvm/llvm_ocaml.c b/llvm/bindings/ocaml/llvm/llvm_ocaml.c -index a9d25751fd2c..0154b2f49c25 100644 ---- a/llvm/bindings/ocaml/llvm/llvm_ocaml.c -+++ b/llvm/bindings/ocaml/llvm/llvm_ocaml.c -@@ -1385,13 +1385,6 @@ value llvm_const_fpcast(value CV, value T) { - return to_val(Value); - } - --/* llvalue -> llvalue -> llvalue -> llvalue */ --value llvm_const_select(value Cond, value IfTrue, value IfFalse) { -- LLVMValueRef Value = -- LLVMConstSelect(Value_val(Cond), Value_val(IfTrue), Value_val(IfFalse)); -- return to_val(Value); --} -- - /* llvalue -> llvalue -> llvalue */ - value llvm_const_extractelement(value V, value I) { - LLVMValueRef Value = LLVMConstExtractElement(Value_val(V), Value_val(I)); -diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst -index 4cf01ad8e284..56da5be434eb 100644 ---- a/llvm/docs/ReleaseNotes.rst -+++ b/llvm/docs/ReleaseNotes.rst -@@ -56,6 +56,11 @@ Changes to the LLVM IR - * The ``nofpclass`` attribute was introduced. This allows more - optimizations around special floating point value comparisons. - -+* The constant expression variants of the following instructions have been -+ removed: -+ -+ * ``select`` -+ - Changes to building LLVM - ------------------------ - -@@ -151,6 +156,12 @@ Changes to the C API - These belonged to the no longer supported legacy pass manager. - * As part of the opaque pointer transition, ``LLVMGetElementType`` no longer - gives the pointee type of a pointer type. -+* The following functions for creating constant expressions have been removed, -+ because the underlying constant expressions are no longer supported. Instead, -+ an instruction should be created using the ``LLVMBuildXYZ`` APIs, which will -+ constant fold the operands if possible and create an instruction otherwise: -+ -+ * ``LLVMConstSelect`` - - Changes to the FastISel infrastructure - -------------------------------------- -diff --git a/llvm/include/llvm-c/Core.h b/llvm/include/llvm-c/Core.h -index 5454cc2d96c5..f2959ac8d22d 100644 ---- a/llvm/include/llvm-c/Core.h -+++ b/llvm/include/llvm-c/Core.h -@@ -2257,9 +2257,6 @@ LLVMValueRef LLVMConstPointerCast(LLVMValueRef ConstantVal, - LLVMValueRef LLVMConstIntCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType, - LLVMBool isSigned); - LLVMValueRef LLVMConstFPCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType); --LLVMValueRef LLVMConstSelect(LLVMValueRef ConstantCondition, -- LLVMValueRef ConstantIfTrue, -- LLVMValueRef ConstantIfFalse); - LLVMValueRef LLVMConstExtractElement(LLVMValueRef VectorConstant, - LLVMValueRef IndexConstant); - LLVMValueRef LLVMConstInsertElement(LLVMValueRef VectorConstant, -diff --git a/llvm/include/llvm/IR/Constants.h b/llvm/include/llvm/IR/Constants.h -index e82c6a8e1eab..13d5fb218bed 100644 ---- a/llvm/include/llvm/IR/Constants.h -+++ b/llvm/include/llvm/IR/Constants.h -@@ -1208,12 +1208,6 @@ public: - /// Return true if this is a compare constant expression - bool isCompare() const; - -- /// Select constant expr -- /// -- /// \param OnlyIfReducedTy see \a getWithOperands() docs. -- static Constant *getSelect(Constant *C, Constant *V1, Constant *V2, -- Type *OnlyIfReducedTy = nullptr); -- - /// get - Return a binary or shift operator constant expression, - /// folding if possible. - /// -diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp -index 8b8ba4107e71..8ee1b665c9b7 100644 ---- a/llvm/lib/AsmParser/LLParser.cpp -+++ b/llvm/lib/AsmParser/LLParser.cpp -@@ -3882,6 +3882,8 @@ bool LLParser::parseValID(ValID &ID, PerFunctionState *PFS, Type *ExpectedTy) { - return error(ID.Loc, "frem constexprs are no longer supported"); - case lltok::kw_fneg: - return error(ID.Loc, "fneg constexprs are no longer supported"); -+ case lltok::kw_select: -+ return error(ID.Loc, "select constexprs are no longer supported"); - case lltok::kw_icmp: - case lltok::kw_fcmp: { - unsigned PredVal, Opc = Lex.getUIntVal(); -@@ -4011,8 +4013,7 @@ bool LLParser::parseValID(ValID &ID, PerFunctionState *PFS, Type *ExpectedTy) { - case lltok::kw_getelementptr: - case lltok::kw_shufflevector: - case lltok::kw_insertelement: -- case lltok::kw_extractelement: -- case lltok::kw_select: { -+ case lltok::kw_extractelement: { - unsigned Opc = Lex.getUIntVal(); - SmallVector<Constant*, 16> Elts; - bool InBounds = false; -@@ -4091,13 +4092,6 @@ bool LLParser::parseValID(ValID &ID, PerFunctionState *PFS, Type *ExpectedTy) { - - ID.ConstantVal = ConstantExpr::getGetElementPtr(Ty, Elts[0], Indices, - InBounds, InRangeOp); -- } else if (Opc == Instruction::Select) { -- if (Elts.size() != 3) -- return error(ID.Loc, "expected three operands to select"); -- if (const char *Reason = SelectInst::areInvalidOperands(Elts[0], Elts[1], -- Elts[2])) -- return error(ID.Loc, Reason); -- ID.ConstantVal = ConstantExpr::getSelect(Elts[0], Elts[1], Elts[2]); - } else if (Opc == Instruction::ShuffleVector) { - if (Elts.size() != 3) - return error(ID.Loc, "expected three operands to shufflevector"); -diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp -index dd75542164d3..64616240d4a3 100644 ---- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp -+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp -@@ -1417,7 +1417,13 @@ static bool isConstExprSupported(const BitcodeConstant *BC) { - if (Opcode == Instruction::GetElementPtr) - return ConstantExpr::isSupportedGetElementPtr(BC->SrcElemTy); - -- return Opcode != Instruction::FNeg; -+ switch (Opcode) { -+ case Instruction::FNeg: -+ case Instruction::Select: -+ return false; -+ default: -+ return true; -+ } - } - - Expected<Value *> BitcodeReader::materializeValue(unsigned StartValID, -@@ -1549,9 +1555,6 @@ Expected<Value *> BitcodeReader::materializeValue(unsigned StartValID, - ArrayRef(ConstOps).drop_front(), - BC->Flags, BC->getInRangeIndex()); - break; -- case Instruction::Select: -- C = ConstantExpr::getSelect(ConstOps[0], ConstOps[1], ConstOps[2]); -- break; - case Instruction::ExtractElement: - C = ConstantExpr::getExtractElement(ConstOps[0], ConstOps[1]); - break; -diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp -index 51756eb8ecb0..a368ac303bd9 100644 ---- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp -+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp -@@ -2676,12 +2676,6 @@ void ModuleBitcodeWriter::writeConstants(unsigned FirstVal, unsigned LastVal, - } - break; - } -- case Instruction::Select: -- Code = bitc::CST_CODE_CE_SELECT; -- Record.push_back(VE.getValueID(C->getOperand(0))); -- Record.push_back(VE.getValueID(C->getOperand(1))); -- Record.push_back(VE.getValueID(C->getOperand(2))); -- break; - case Instruction::ExtractElement: - Code = bitc::CST_CODE_CE_EXTRACTELT; - Record.push_back(VE.getTypeID(C->getOperand(0)->getType())); -diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp -index 553bc1e277e3..59131a4264fc 100644 ---- a/llvm/lib/IR/ConstantFold.cpp -+++ b/llvm/lib/IR/ConstantFold.cpp -@@ -593,17 +593,6 @@ Constant *llvm::ConstantFoldSelectInstruction(Constant *Cond, - if (isa<UndefValue>(V1) && NotPoison(V2)) return V2; - if (isa<UndefValue>(V2) && NotPoison(V1)) return V1; - -- if (ConstantExpr *TrueVal = dyn_cast<ConstantExpr>(V1)) { -- if (TrueVal->getOpcode() == Instruction::Select) -- if (TrueVal->getOperand(0) == Cond) -- return ConstantExpr::getSelect(Cond, TrueVal->getOperand(1), V2); -- } -- if (ConstantExpr *FalseVal = dyn_cast<ConstantExpr>(V2)) { -- if (FalseVal->getOpcode() == Instruction::Select) -- if (FalseVal->getOperand(0) == Cond) -- return ConstantExpr::getSelect(Cond, V1, FalseVal->getOperand(2)); -- } -- - return nullptr; - } - -diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp -index 9348d1af65a4..51ad3a12c488 100644 ---- a/llvm/lib/IR/Constants.cpp -+++ b/llvm/lib/IR/Constants.cpp -@@ -547,8 +547,6 @@ void llvm::deleteConstant(Constant *C) { - delete static_cast<CastConstantExpr *>(C); - else if (isa<BinaryConstantExpr>(C)) - delete static_cast<BinaryConstantExpr *>(C); -- else if (isa<SelectConstantExpr>(C)) -- delete static_cast<SelectConstantExpr *>(C); - else if (isa<ExtractElementConstantExpr>(C)) - delete static_cast<ExtractElementConstantExpr *>(C); - else if (isa<InsertElementConstantExpr>(C)) -@@ -1488,8 +1486,6 @@ Constant *ConstantExpr::getWithOperands(ArrayRef<Constant *> Ops, Type *Ty, - case Instruction::BitCast: - case Instruction::AddrSpaceCast: - return ConstantExpr::getCast(getOpcode(), Ops[0], Ty, OnlyIfReduced); -- case Instruction::Select: -- return ConstantExpr::getSelect(Ops[0], Ops[1], Ops[2], OnlyIfReducedTy); - case Instruction::InsertElement: - return ConstantExpr::getInsertElement(Ops[0], Ops[1], Ops[2], - OnlyIfReducedTy); -@@ -2441,23 +2437,6 @@ Constant *ConstantExpr::getCompare(unsigned short Predicate, Constant *C1, - } - } - --Constant *ConstantExpr::getSelect(Constant *C, Constant *V1, Constant *V2, -- Type *OnlyIfReducedTy) { -- assert(!SelectInst::areInvalidOperands(C, V1, V2)&&"Invalid select operands"); -- -- if (Constant *SC = ConstantFoldSelectInstruction(C, V1, V2)) -- return SC; // Fold common cases -- -- if (OnlyIfReducedTy == V1->getType()) -- return nullptr; -- -- Constant *ArgVec[] = { C, V1, V2 }; -- ConstantExprKeyType Key(Instruction::Select, ArgVec); -- -- LLVMContextImpl *pImpl = C->getContext().pImpl; -- return pImpl->ExprConstants.getOrCreate(V1->getType(), Key); --} -- - Constant *ConstantExpr::getGetElementPtr(Type *Ty, Constant *C, - ArrayRef<Value *> Idxs, bool InBounds, - std::optional<unsigned> InRangeIndex, -@@ -3439,8 +3418,6 @@ Instruction *ConstantExpr::getAsInstruction(Instruction *InsertBefore) const { - case Instruction::AddrSpaceCast: - return CastInst::Create((Instruction::CastOps)getOpcode(), Ops[0], - getType(), "", InsertBefore); -- case Instruction::Select: -- return SelectInst::Create(Ops[0], Ops[1], Ops[2], "", InsertBefore); - case Instruction::InsertElement: - return InsertElementInst::Create(Ops[0], Ops[1], Ops[2], "", InsertBefore); - case Instruction::ExtractElement: -diff --git a/llvm/lib/IR/ConstantsContext.h b/llvm/lib/IR/ConstantsContext.h -index fbda443de7b2..6023216a5070 100644 ---- a/llvm/lib/IR/ConstantsContext.h -+++ b/llvm/lib/IR/ConstantsContext.h -@@ -90,32 +90,6 @@ public: - } - }; - --/// SelectConstantExpr - This class is private to Constants.cpp, and is used --/// behind the scenes to implement select constant exprs. --class SelectConstantExpr final : public ConstantExpr { --public: -- SelectConstantExpr(Constant *C1, Constant *C2, Constant *C3) -- : ConstantExpr(C2->getType(), Instruction::Select, &Op<0>(), 3) { -- Op<0>() = C1; -- Op<1>() = C2; -- Op<2>() = C3; -- } -- -- // allocate space for exactly three operands -- void *operator new(size_t S) { return User::operator new(S, 3); } -- void operator delete(void *Ptr) { User::operator delete(Ptr); } -- -- /// Transparently provide more efficient getOperand methods. -- DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value); -- -- static bool classof(const ConstantExpr *CE) { -- return CE->getOpcode() == Instruction::Select; -- } -- static bool classof(const Value *V) { -- return isa<ConstantExpr>(V) && classof(cast<ConstantExpr>(V)); -- } --}; -- - /// ExtractElementConstantExpr - This class is private to - /// Constants.cpp, and is used behind the scenes to implement - /// extractelement constant exprs. -@@ -279,11 +253,6 @@ struct OperandTraits<BinaryConstantExpr> - : public FixedNumOperandTraits<BinaryConstantExpr, 2> {}; - DEFINE_TRANSPARENT_OPERAND_ACCESSORS(BinaryConstantExpr, Value) - --template <> --struct OperandTraits<SelectConstantExpr> -- : public FixedNumOperandTraits<SelectConstantExpr, 3> {}; --DEFINE_TRANSPARENT_OPERAND_ACCESSORS(SelectConstantExpr, Value) -- - template <> - struct OperandTraits<ExtractElementConstantExpr> - : public FixedNumOperandTraits<ExtractElementConstantExpr, 2> {}; -@@ -523,8 +492,6 @@ public: - return new BinaryConstantExpr(Opcode, Ops[0], Ops[1], - SubclassOptionalData); - llvm_unreachable("Invalid ConstantExpr!"); -- case Instruction::Select: -- return new SelectConstantExpr(Ops[0], Ops[1], Ops[2]); - case Instruction::ExtractElement: - return new ExtractElementConstantExpr(Ops[0], Ops[1]); - case Instruction::InsertElement: -diff --git a/llvm/lib/IR/Core.cpp b/llvm/lib/IR/Core.cpp -index 85b7d17ef56c..283296b639ff 100644 ---- a/llvm/lib/IR/Core.cpp -+++ b/llvm/lib/IR/Core.cpp -@@ -1799,14 +1799,6 @@ LLVMValueRef LLVMConstFPCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType) { - unwrap(ToType))); - } - --LLVMValueRef LLVMConstSelect(LLVMValueRef ConstantCondition, -- LLVMValueRef ConstantIfTrue, -- LLVMValueRef ConstantIfFalse) { -- return wrap(ConstantExpr::getSelect(unwrap<Constant>(ConstantCondition), -- unwrap<Constant>(ConstantIfTrue), -- unwrap<Constant>(ConstantIfFalse))); --} -- - LLVMValueRef LLVMConstExtractElement(LLVMValueRef VectorConstant, - LLVMValueRef IndexConstant) { - return wrap(ConstantExpr::getExtractElement(unwrap<Constant>(VectorConstant), -diff --git a/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp b/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp -index 114738a35fd1..b6713730bfa9 100644 ---- a/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp -+++ b/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp -@@ -694,18 +694,6 @@ static Value *cloneConstantExprWithNewAddressSpace( - return ConstantExpr::getAddrSpaceCast(CE, TargetType); - } - -- if (CE->getOpcode() == Instruction::Select) { -- Constant *Src0 = CE->getOperand(1); -- Constant *Src1 = CE->getOperand(2); -- if (Src0->getType()->getPointerAddressSpace() == -- Src1->getType()->getPointerAddressSpace()) { -- -- return ConstantExpr::getSelect( -- CE->getOperand(0), ConstantExpr::getAddrSpaceCast(Src0, TargetType), -- ConstantExpr::getAddrSpaceCast(Src1, TargetType)); -- } -- } -- - if (CE->getOpcode() == Instruction::IntToPtr) { - assert(isNoopPtrIntCastPair(cast<Operator>(CE), *DL, TTI)); - Constant *Src = cast<ConstantExpr>(CE->getOperand(0))->getOperand(0); -diff --git a/llvm/test/Analysis/ScalarEvolution/logical-operations.ll b/llvm/test/Analysis/ScalarEvolution/logical-operations.ll -index e14f47f0e15a..d557f50326d5 100644 ---- a/llvm/test/Analysis/ScalarEvolution/logical-operations.ll -+++ b/llvm/test/Analysis/ScalarEvolution/logical-operations.ll -@@ -410,11 +410,14 @@ define ptr @select_between_constantptrs(i1 %c, ptr %x) { - define ptr @tautological_select() { - ; CHECK-LABEL: 'tautological_select' - ; CHECK-NEXT: Classifying expressions for: @tautological_select --; CHECK-NEXT: %r = getelementptr i8, ptr @constant, i32 0 -+; CHECK-NEXT: %s = select i1 true, ptr @constant, ptr @another_constant -+; CHECK-NEXT: --> @constant U: [0,-3) S: [-9223372036854775808,9223372036854775805) -+; CHECK-NEXT: %r = getelementptr i8, ptr %s - ; CHECK-NEXT: --> @constant U: [0,-3) S: [-9223372036854775808,9223372036854775805) - ; CHECK-NEXT: Determining loop execution counts for: @tautological_select - ; -- %r = getelementptr i8, ptr select (i1 true, ptr @constant, ptr @another_constant), i32 0 -+ %s = select i1 true, ptr @constant, ptr @another_constant -+ %r = getelementptr i8, ptr %s - ret ptr %r - } - -diff --git a/llvm/test/Assembler/ConstantExprFoldSelect.ll b/llvm/test/Assembler/ConstantExprFoldSelect.ll -index 5d218a9570b9..1ece1f87c340 100644 ---- a/llvm/test/Assembler/ConstantExprFoldSelect.ll -+++ b/llvm/test/Assembler/ConstantExprFoldSelect.ll -@@ -1,9 +1,9 @@ --; RUN: llvm-as < %s | llvm-dis | FileCheck %s -+; RUN: opt -S -passes=instsimplify < %s | FileCheck %s - ; RUN: verify-uselistorder %s - ; PR18319 - --define void @function() { -- %c = trunc <4 x i16> select (<4 x i1> <i1 undef, i1 undef, i1 false, i1 true>, <4 x i16> <i16 undef, i16 2, i16 3, i16 4>, <4 x i16> <i16 -1, i16 -2, i16 -3, i16 -4>) to <4 x i8> -+define <4 x i16> @function() { -+ %s = select <4 x i1> <i1 undef, i1 undef, i1 false, i1 true>, <4 x i16> <i16 undef, i16 2, i16 3, i16 4>, <4 x i16> <i16 -1, i16 -2, i16 -3, i16 -4> - ; CHECK: <i16 undef, i16 -2, i16 -3, i16 4> -- ret void -+ ret <4 x i16> %s - } -diff --git a/llvm/test/Bindings/OCaml/core.ml b/llvm/test/Bindings/OCaml/core.ml -index 33841deb42cf..d2dd52c07608 100644 ---- a/llvm/test/Bindings/OCaml/core.ml -+++ b/llvm/test/Bindings/OCaml/core.ml -@@ -333,7 +333,6 @@ let test_constants () = - group "misc constants"; - (* CHECK: const_size_of{{.*}}getelementptr{{.*}}null - * CHECK: const_gep{{.*}}getelementptr -- * CHECK: const_select{{.*}}select - * CHECK: const_extractelement{{.*}}extractelement - * CHECK: const_insertelement{{.*}}insertelement - * CHECK: const_shufflevector = global <4 x i32> <i32 0, i32 1, i32 1, i32 0> -@@ -341,10 +340,6 @@ let test_constants () = - ignore (define_global "const_size_of" (size_of (pointer_type context)) m); - ignore (define_global "const_gep" (const_gep i8_type foldbomb_gv [| five |]) - m); -- ignore (define_global "const_select" (const_select -- (const_icmp Icmp.Sle foldbomb five) -- (const_int i8_type (-1)) -- (const_int i8_type 0)) m); - let zero = const_int i32_type 0 in - let one = const_int i32_type 1 in - ignore (define_global "const_extractelement" (const_extractelement -diff --git a/llvm/test/Bitcode/select.ll b/llvm/test/Bitcode/select.ll -deleted file mode 100644 -index 7e62361822a8..000000000000 ---- a/llvm/test/Bitcode/select.ll -+++ /dev/null -@@ -1,18 +0,0 @@ --; RUN: llvm-as < %s | llvm-dis | FileCheck %s --; RUN: verify-uselistorder < %s -- --define <2 x i32> @main() { -- ret <2 x i32> select (<2 x i1> <i1 false, i1 undef>, <2 x i32> zeroinitializer, <2 x i32> <i32 0, i32 undef>) --} -- --; CHECK: define <2 x i32> @main() { --; CHECK: ret <2 x i32> <i32 0, i32 undef> --; CHECK: } -- --define <2 x float> @f() { -- ret <2 x float> select (i1 ptrtoint (<2 x float> ()* @f to i1), <2 x float> <float 1.000000e+00, float 0.000000e+00>, <2 x float> zeroinitializer) --} -- --; CHECK: define <2 x float> @f() { --; CHECK: ret <2 x float> select (i1 ptrtoint (ptr @f to i1), <2 x float> <float 1.000000e+00, float 0.000000e+00>, <2 x float> zeroinitializer) --; CHECK: } -diff --git a/llvm/test/Bitcode/thinlto-function-summary-callgraph-cast.ll b/llvm/test/Bitcode/thinlto-function-summary-callgraph-cast.ll -index 1926603b8b1f..4d52edd6a085 100644 ---- a/llvm/test/Bitcode/thinlto-function-summary-callgraph-cast.ll -+++ b/llvm/test/Bitcode/thinlto-function-summary-callgraph-cast.ll -@@ -9,7 +9,7 @@ - ; "op7" is a call to "callee" function. - ; CHECK-NEXT: <PERMODULE {{.*}} op7=3 op8=[[ALIASID:[0-9]+]]/> - ; "another_caller" has only references but no calls. --; CHECK-NEXT: <PERMODULE {{.*}} op4=3 {{.*}} op9={{[0-9]+}}/> -+; CHECK-NEXT: <PERMODULE {{.*}}/> - ; CHECK-NEXT: <PERMODULE {{.*}} op0=[[ALIASEEID:[0-9]+]] - ; CHECK-NEXT: <ALIAS {{.*}} op0=[[ALIASID]] {{.*}} op2=[[ALIASEEID]]/> - ; CHECK-NEXT: <BLOCK_COUNT op0=3/> -@@ -27,7 +27,7 @@ define void @caller() { - - define void @another_caller() { - ; Test calls that aren't handled either as direct or indirect. -- call void select (i1 icmp eq (ptr @global, ptr null), ptr @f, ptr @g)() -+ call void getelementptr (i8, ptr @f, i64 ptrtoint (ptr @g to i64))() - ret void - } - -diff --git a/llvm/test/Bitcode/vscale-round-trip.ll b/llvm/test/Bitcode/vscale-round-trip.ll -index 62a3479a3724..1962e90fa464 100644 ---- a/llvm/test/Bitcode/vscale-round-trip.ll -+++ b/llvm/test/Bitcode/vscale-round-trip.ll -@@ -36,14 +36,14 @@ define <vscale x 4 x i32> @non_const_shufflevector(<vscale x 4 x i32> %lhs, - } - - ; CHECK-LABEL: define <vscale x 4 x i32> @const_select() --; CHECK: <vscale x 4 x i32> select (<vscale x 4 x i1> -+; CHECK: select <vscale x 4 x i1> - - define <vscale x 4 x i32> @const_select() { -- ret <vscale x 4 x i32> select -- (<vscale x 4 x i1> insertelement -+ %s = select <vscale x 4 x i1> insertelement - (<vscale x 4 x i1> undef, - i1 icmp ne (i32* @important_val, i32* null), - i32 0), - <vscale x 4 x i32> zeroinitializer, -- <vscale x 4 x i32> insertelement (<vscale x 4 x i32> undef, i32 1, i32 0)) -+ <vscale x 4 x i32> insertelement (<vscale x 4 x i32> undef, i32 1, i32 0) -+ ret <vscale x 4 x i32> %s - } -diff --git a/llvm/test/CodeGen/AMDGPU/GlobalISel/irtranslator-constantexpr.ll b/llvm/test/CodeGen/AMDGPU/GlobalISel/irtranslator-constantexpr.ll -index 6a0975f7fa72..9f96b1d0d719 100644 ---- a/llvm/test/CodeGen/AMDGPU/GlobalISel/irtranslator-constantexpr.ll -+++ b/llvm/test/CodeGen/AMDGPU/GlobalISel/irtranslator-constantexpr.ll -@@ -20,43 +20,6 @@ define i32 @test() { - ret i32 bitcast (<1 x i32> <i32 extractelement (<1 x i32> bitcast (i32 zext (i1 icmp eq (ptr @var, ptr inttoptr (i32 -1 to ptr)) to i32) to <1 x i32>), i64 0)> to i32) - } - --@gint = external addrspace(1) global i8, align 4 -- --; Technically we should be able to fold away the compare to true, but --; currently constexpr doesn't understand null in non-0 address spaces. --define amdgpu_kernel void @constantexpr_select_0() { -- ; CHECK-LABEL: name: constantexpr_select_0 -- ; CHECK: bb.1 (%ir-block.0): -- ; CHECK-NEXT: [[GV:%[0-9]+]]:_(p1) = G_GLOBAL_VALUE @gint -- ; CHECK-NEXT: [[C:%[0-9]+]]:_(p1) = G_CONSTANT i64 0 -- ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[GV]](p1), [[C]] -- ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 -- ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 0 -- ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s1), [[C1]], [[C2]] -- ; CHECK-NEXT: [[DEF:%[0-9]+]]:_(p1) = G_IMPLICIT_DEF -- ; CHECK-NEXT: G_STORE [[SELECT]](s32), [[DEF]](p1) :: (store (s32) into `ptr addrspace(1) undef`, addrspace 1) -- ; CHECK-NEXT: S_ENDPGM 0 -- store i32 select (i1 icmp eq (ptr addrspace(1) @gint, ptr addrspace(1) null), i32 1, i32 0), ptr addrspace(1) undef, align 4 -- ret void --} -- --define amdgpu_kernel void @constantexpr_select_1() { -- ; CHECK-LABEL: name: constantexpr_select_1 -- ; CHECK: bb.1 (%ir-block.0): -- ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1024 -- ; CHECK-NEXT: [[INTTOPTR:%[0-9]+]]:_(p1) = G_INTTOPTR [[C]](s64) -- ; CHECK-NEXT: [[GV:%[0-9]+]]:_(p1) = G_GLOBAL_VALUE @gint -- ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(eq), [[INTTOPTR]](p1), [[GV]] -- ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 -- ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 0 -- ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s1), [[C1]], [[C2]] -- ; CHECK-NEXT: [[DEF:%[0-9]+]]:_(p1) = G_IMPLICIT_DEF -- ; CHECK-NEXT: G_STORE [[SELECT]](s32), [[DEF]](p1) :: (store (s32) into `ptr addrspace(1) undef`, addrspace 1) -- ; CHECK-NEXT: S_ENDPGM 0 -- store i32 select (i1 icmp eq (ptr addrspace(1) @gint, ptr addrspace(1) inttoptr (i64 1024 to ptr addrspace(1))), i32 1, i32 0), ptr addrspace(1) undef, align 4 -- ret void --} -- - @a = external global [2 x i32], align 4 - - define i32 @test_fcmp_constexpr() { -diff --git a/llvm/test/CodeGen/Generic/pr33094.ll b/llvm/test/CodeGen/Generic/pr33094.ll -index f1cf67b0ae63..cd98ec3b139b 100644 ---- a/llvm/test/CodeGen/Generic/pr33094.ll -+++ b/llvm/test/CodeGen/Generic/pr33094.ll -@@ -12,8 +12,8 @@ - @B_Inst = global %B zeroinitializer - - define i64 @foo() { -- %e = extractvalue %Tuple select (i1 icmp eq -- (ptr @A_Inst, ptr @B_Inst), -- %Tuple { i64 33 }, %Tuple { i64 42 }), 0 -+ %s = select i1 icmp eq (ptr @A_Inst, ptr @B_Inst), -+ %Tuple { i64 33 }, %Tuple { i64 42 } -+ %e = extractvalue %Tuple %s, 0 - ret i64 %e - } -diff --git a/llvm/test/CodeGen/PowerPC/ext-bool-trunc-repl.ll b/llvm/test/CodeGen/PowerPC/ext-bool-trunc-repl.ll -index b12414e159a7..a64354222fa7 100644 ---- a/llvm/test/CodeGen/PowerPC/ext-bool-trunc-repl.ll -+++ b/llvm/test/CodeGen/PowerPC/ext-bool-trunc-repl.ll -@@ -11,26 +11,35 @@ define void @fn2() #0 { - - br i1 undef, label %1, label %10 - --; <label>:1: ; preds = %0 -+1: ; preds = %0 - br i1 undef, label %3, label %2 - --; <label>:2: ; preds = %2, %1 -+2: ; preds = %2, %1 - br i1 undef, label %3, label %2 - --; <label>:3: ; preds = %2, %1 -+3: ; preds = %2, %1 - br i1 undef, label %8, label %4 - --; <label>:4: ; preds = %4, %3 -+4: ; preds = %4, %3 - %5 = phi i64 [ %6, %4 ], [ undef, %3 ] -- %6 = and i64 %5, and (i64 and (i64 and (i64 and (i64 and (i64 and (i64 and (i64 sext (i32 select (i1 icmp slt (i16 zext (i1 icmp eq (ptr getelementptr inbounds ([2 x i32], ptr @d, i64 0, i64 1), ptr @c) to i16), i16 0), i32 zext (i1 icmp eq (ptr getelementptr inbounds ([2 x i32], ptr @d, i64 0, i64 1), ptr @c) to i32), i32 lshr (i32 zext (i1 icmp eq (ptr getelementptr inbounds ([2 x i32], ptr @d, i64 0, i64 1), ptr @c) to i32), i32 6)) to i64), i64 sext (i32 select (i1 icmp slt (i16 zext (i1 icmp eq (ptr getelementptr inbounds ([2 x i32], ptr @d, i64 0, i64 1), ptr @c) to i16), i16 0), i32 zext (i1 icmp eq (ptr getelementptr inbounds ([2 x i32], ptr @d, i64 0, i64 1), ptr @c) to i32), i32 lshr (i32 zext (i1 icmp eq (ptr getelementptr inbounds ([2 x i32], ptr @d, i64 0, i64 1), ptr @c) to i32), i32 6)) to i64)), i64 sext (i32 select (i1 icmp slt (i16 zext (i1 icmp eq (ptr getelementptr inbounds ([2 x i32], ptr @d, i64 0, i64 1), ptr @c) to i16), i16 0), i32 zext (i1 icmp eq (ptr getelementptr inbounds ([2 x i32], ptr @d, i64 0, i64 1), ptr @c) to i32), i32 lshr (i32 zext (i1 icmp eq (ptr getelementptr inbounds ([2 x i32], ptr @d, i64 0, i64 1), ptr @c) to i32), i32 6)) to i64)), i64 sext (i32 select (i1 icmp slt (i16 zext (i1 icmp eq (ptr getelementptr inbounds ([2 x i32], ptr @d, i64 0, i64 1), ptr @c) to i16), i16 0), i32 zext (i1 icmp eq (ptr getelementptr inbounds ([2 x i32], ptr @d, i64 0, i64 1), ptr @c) to i32), i32 lshr (i32 zext (i1 icmp eq (ptr getelementptr inbounds ([2 x i32], ptr @d, i64 0, i64 1), ptr @c) to i32), i32 6)) to i64)), i64 sext (i32 select (i1 icmp slt (i16 zext (i1 icmp eq (ptr getelementptr inbounds ([2 x i32], ptr @d, i64 0, i64 1), ptr @c) to i16), i16 0), i32 zext (i1 icmp eq (ptr getelementptr inbounds ([2 x i32], ptr @d, i64 0, i64 1), ptr @c) to i32), i32 lshr (i32 zext (i1 icmp eq (ptr getelementptr inbounds ([2 x i32], ptr @d, i64 0, i64 1), ptr @c) to i32), i32 6)) to i64)), i64 sext (i32 select (i1 icmp slt (i16 zext (i1 icmp eq (ptr getelementptr inbounds ([2 x i32], ptr @d, i64 0, i64 1), ptr @c) to i16), i16 0), i32 zext (i1 icmp eq (ptr getelementptr inbounds ([2 x i32], ptr @d, i64 0, i64 1), ptr @c) to i32), i32 lshr (i32 zext (i1 icmp eq (ptr getelementptr inbounds ([2 x i32], ptr @d, i64 0, i64 1), ptr @c) to i32), i32 6)) to i64)), i64 sext (i32 select (i1 icmp slt (i16 zext (i1 icmp eq (ptr getelementptr inbounds ([2 x i32], ptr @d, i64 0, i64 1), ptr @c) to i16), i16 0), i32 zext (i1 icmp eq (ptr getelementptr inbounds ([2 x i32], ptr @d, i64 0, i64 1), ptr @c) to i32), i32 lshr (i32 zext (i1 icmp eq (ptr getelementptr inbounds ([2 x i32], ptr @d, i64 0, i64 1), ptr @c) to i32), i32 6)) to i64)), i64 sext (i32 select (i1 icmp slt (i16 zext (i1 icmp eq (ptr getelementptr inbounds ([2 x i32], ptr @d, i64 0, i64 1), ptr @c) to i16), i16 0), i32 zext (i1 icmp eq (ptr getelementptr inbounds ([2 x i32], ptr @d, i64 0, i64 1), ptr @c) to i32), i32 lshr (i32 zext (i1 icmp eq (ptr getelementptr inbounds ([2 x i32], ptr @d, i64 0, i64 1), ptr @c) to i32), i32 6)) to i64)) -+ %constexpr = select i1 icmp slt (i16 zext (i1 icmp eq (ptr getelementptr inbounds ([2 x i32], ptr @d, i64 0, i64 1), ptr @c) to i16), i16 0), i32 zext (i1 icmp eq (ptr getelementptr inbounds ([2 x i32], ptr @d, i64 0, i64 1), ptr @c) to i32), i32 lshr (i32 zext (i1 icmp eq (ptr getelementptr inbounds ([2 x i32], ptr @d, i64 0, i64 1), ptr @c) to i32), i32 6) -+ %constexpr1 = sext i32 %constexpr to i64 -+ %constexpr2 = and i64 %constexpr1, %constexpr1 -+ %constexpr3 = and i64 %constexpr2, %constexpr1 -+ %constexpr4 = and i64 %constexpr3, %constexpr1 -+ %constexpr5 = and i64 %constexpr4, %constexpr1 -+ %constexpr6 = and i64 %constexpr5, %constexpr1 -+ %constexpr7 = and i64 %constexpr6, %constexpr1 -+ %constexpr8 = and i64 %constexpr7, %constexpr1 -+ %6 = and i64 %5, %constexpr8 - %7 = icmp slt i32 undef, 6 - br i1 %7, label %4, label %8 - --; <label>:8: ; preds = %4, %3 -+8: ; preds = %4, %3 - %9 = phi i64 [ undef, %3 ], [ %6, %4 ] - br label %10 - --; <label>:10: ; preds = %8, %0 -+10: ; preds = %8, %0 - ret void - } - -diff --git a/llvm/test/CodeGen/PowerPC/pr24636.ll b/llvm/test/CodeGen/PowerPC/pr24636.ll -index d423e6a053f0..bb13a7aa6c2d 100644 ---- a/llvm/test/CodeGen/PowerPC/pr24636.ll -+++ b/llvm/test/CodeGen/PowerPC/pr24636.ll -@@ -2,7 +2,7 @@ - target datalayout = "e-m:e-i64:64-n32:64" - target triple = "powerpc64le-unknown-linux-gnu" - --@c = external global i32, align 4 -+@c = external unnamed_addr global i32, align 4 - @b = external global [1 x i32], align 4 - - ; Function Attrs: nounwind -@@ -25,7 +25,16 @@ define void @fn2() #0 align 4 { - - .lr.ph.split.split: ; preds = %.lr.ph.split.split, %.lr.ph.split - %1 = phi i32 [ %2, %.lr.ph.split.split ], [ undef, %.lr.ph.split ] -- %2 = and i32 %1, and (i32 and (i32 and (i32 and (i32 and (i32 and (i32 and (i32 zext (i1 select (i1 icmp eq (ptr @c, ptr @b), i1 true, i1 false) to i32), i32 zext (i1 select (i1 icmp eq (ptr @c, ptr @b), i1 true, i1 false) to i32)), i32 zext (i1 select (i1 icmp eq (ptr @c, ptr @b), i1 true, i1 false) to i32)), i32 zext (i1 select (i1 icmp eq (ptr @c, ptr @b), i1 true, i1 false) to i32)), i32 zext (i1 select (i1 icmp eq (ptr @c, ptr @b), i1 true, i1 false) to i32)), i32 zext (i1 select (i1 icmp eq (ptr @c, ptr @b), i1 true, i1 false) to i32)), i32 zext (i1 select (i1 icmp eq (ptr @c, ptr @b), i1 true, i1 false) to i32)), i32 zext (i1 select (i1 icmp eq (ptr @c, ptr @b), i1 true, i1 false) to i32)) -+ %constexpr = select i1 icmp eq (ptr @c, ptr @b), i1 true, i1 false -+ %constexpr1 = zext i1 %constexpr to i32 -+ %constexpr2 = and i32 %constexpr1, %constexpr1 -+ %constexpr3 = and i32 %constexpr2, %constexpr1 -+ %constexpr4 = and i32 %constexpr3, %constexpr1 -+ %constexpr5 = and i32 %constexpr4, %constexpr1 -+ %constexpr6 = and i32 %constexpr5, %constexpr1 -+ %constexpr7 = and i32 %constexpr6, %constexpr1 -+ %constexpr8 = and i32 %constexpr7, %constexpr1 -+ %2 = and i32 %1, %constexpr8 - %3 = icmp slt i32 undef, 4 - br i1 %3, label %.lr.ph.split.split, label %._crit_edge - -@@ -33,7 +42,7 @@ define void @fn2() #0 align 4 { - %.lcssa = phi i32 [ undef, %.lr.ph.split ], [ %2, %.lr.ph.split.split ] - br label %4 - --; <label>:4 ; preds = %._crit_edge, %0 -+4: ; preds = %._crit_edge, %0 - ret void - } - -diff --git a/llvm/test/CodeGen/WebAssembly/call.ll b/llvm/test/CodeGen/WebAssembly/call.ll -index 0fcc2bed2463..6e7a97118bc9 100644 ---- a/llvm/test/CodeGen/WebAssembly/call.ll -+++ b/llvm/test/CodeGen/WebAssembly/call.ll -@@ -216,7 +216,10 @@ define void @coldcc_tail_call_void_nullary() { - ; CHECK-NEXT: i32.const $push[[L0:[0-9]+]]=, 2{{$}} - ; CHECK-NEXT: i32.const $push[[L1:[0-9]+]]=, 3{{$}} - ; CHECK-NEXT: call .Lvararg_func_bitcast, $pop[[L0]], $pop[[L1]]{{$}} --; CHECK-NEXT: call other_void_nullary{{$}} -+; CHECK-NEXT: i32.const $push[[L3:[0-9]+]]=, void_nullary{{$}} -+; CHECK-NEXT: i32.const $push[[L2:[0-9]+]]=, other_void_nullary{{$}} -+; CHECK-NEXT: i32.add $push[[L4:[0-9]+]]=, $pop[[L3]], $pop[[L2]]{{$}} -+; CHECK-NEXT: call_indirect $pop[[L4]]{{$}} - ; CHECK-NEXT: call void_nullary{{$}} - ; CHECK-NEXT: return{{$}} - declare void @vararg_func(...) -@@ -226,7 +229,7 @@ bb0: - call void @vararg_func(i32 2, i32 3) - br label %bb1 - bb1: -- call void select (i1 0, ptr @void_nullary, ptr @other_void_nullary)() -+ call void getelementptr (i8, ptr @void_nullary, i32 ptrtoint (ptr @other_void_nullary to i32))() - br label %bb2 - bb2: - call void inttoptr (i32 ptrtoint (ptr @void_nullary to i32) to ptr)() -diff --git a/llvm/test/CodeGen/X86/2008-09-19-RegAllocBug.ll b/llvm/test/CodeGen/X86/2008-09-19-RegAllocBug.ll -index 61b54ee271c2..f027f3aa77d7 100644 ---- a/llvm/test/CodeGen/X86/2008-09-19-RegAllocBug.ll -+++ b/llvm/test/CodeGen/X86/2008-09-19-RegAllocBug.ll -@@ -9,10 +9,11 @@ entry: - %1 = trunc i32 %0 to i8 ; <i8> [#uses=1] - %2 = sub i8 1, %1 ; <i8> [#uses=1] - %3 = sext i8 %2 to i32 ; <i32> [#uses=1] -- %.0 = ashr i32 %3, select (i1 icmp ne (i8 zext (i1 icmp ugt (i32 ptrtoint (ptr @func_4 to i32), i32 3) to i8), i8 0), i32 0, i32 ptrtoint (ptr @func_4 to i32)) ; <i32> [#uses=1] -- %4 = urem i32 %0, %.0 ; <i32> [#uses=1] -- %5 = icmp eq i32 %4, 0 ; <i1> [#uses=1] -- br i1 %5, label %return, label %bb4 -+ %s = select i1 icmp ne (i8 zext (i1 icmp ugt (i32 ptrtoint (ptr @func_4 to i32), i32 3) to i8), i8 0), i32 0, i32 ptrtoint (ptr @func_4 to i32) -+ %ashr = ashr i32 %3, %s -+ %urem = urem i32 %0, %ashr -+ %cmp = icmp eq i32 %urem, 0 -+ br i1 %cmp, label %return, label %bb4 - - bb4: ; preds = %entry - ret i32 undef -diff --git a/llvm/test/CodeGen/X86/no-plt.ll b/llvm/test/CodeGen/X86/no-plt.ll -index d6285a828a3b..807731cea314 100644 ---- a/llvm/test/CodeGen/X86/no-plt.ll -+++ b/llvm/test/CodeGen/X86/no-plt.ll -@@ -5,7 +5,8 @@ - - define i32 @fp_weakfunc() { - ; X64: weakfunc@GOTPCREL(%rip) -- ret i32 select (i1 icmp ne (ptr @weakfunc, ptr null), i32 1, i32 0) -+ %s = select i1 icmp ne (ptr @weakfunc, ptr null), i32 1, i32 0 -+ ret i32 %s - } - declare extern_weak i32 @weakfunc() nonlazybind - -diff --git a/llvm/test/CodeGen/X86/pr44749.ll b/llvm/test/CodeGen/X86/pr44749.ll -index b2c0e17fc668..cc9963dc2d8c 100644 ---- a/llvm/test/CodeGen/X86/pr44749.ll -+++ b/llvm/test/CodeGen/X86/pr44749.ll -@@ -14,9 +14,9 @@ define i32 @a() { - ; CHECK-NEXT: subq $-1, %rax - ; CHECK-NEXT: setne %al - ; CHECK-NEXT: movzbl %al, %eax --; CHECK-NEXT: movl %eax, %ecx --; CHECK-NEXT: leaq {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %rax --; CHECK-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero -+; CHECK-NEXT: cvtsi2sd %eax, %xmm0 -+; CHECK-NEXT: movsd {{.*#+}} xmm2 = mem[0],zero -+; CHECK-NEXT: subsd %xmm2, %xmm0 - ; CHECK-NEXT: movsd {{.*#+}} xmm3 = mem[0],zero - ; CHECK-NEXT: movsd {{.*#+}} xmm2 = mem[0],zero - ; CHECK-NEXT: cmplesd %xmm1, %xmm0 -@@ -30,7 +30,9 @@ define i32 @a() { - entry: - %call = call i32 (...) @b() - %conv = sitofp i32 %call to double -- %fsub = fsub double sitofp (i32 select (i1 icmp ne (ptr getelementptr (i8, ptr @calloc, i64 1), ptr null), i32 1, i32 0) to double), 1.000000e+02 -+ %sel = select i1 icmp ne (ptr getelementptr (i8, ptr @calloc, i64 1), ptr null), i32 1, i32 0 -+ %sitofp = sitofp i32 %sel to double -+ %fsub = fsub double %sitofp, 1.000000e+02 - %cmp = fcmp ole double %fsub, %conv - %cond = select i1 %cmp, double 1.000000e+00, double 3.140000e+00 - %conv2 = fptosi double %cond to i32 -diff --git a/llvm/test/ThinLTO/X86/funcattrs-prop-unknown.ll b/llvm/test/ThinLTO/X86/funcattrs-prop-unknown.ll -index f6f2dc8b1e82..48fa8f6bbffe 100644 ---- a/llvm/test/ThinLTO/X86/funcattrs-prop-unknown.ll -+++ b/llvm/test/ThinLTO/X86/funcattrs-prop-unknown.ll -@@ -26,7 +26,7 @@ entry: - ; CHECK: define void @selectcallee() { - define void @selectcallee() { - ; Test calls that aren't handled either as direct or indirect. -- call void select (i1 icmp eq (ptr @global, ptr null), ptr @f, ptr @g)() -+ call void getelementptr (i8, ptr @f, i64 ptrtoint (ptr @g to i64))() - ret void - } - -diff --git a/llvm/test/Transforms/InferAddressSpaces/AMDGPU/infer-address-space.ll b/llvm/test/Transforms/InferAddressSpaces/AMDGPU/infer-address-space.ll -index 57935cf7df14..72109d0cff43 100644 ---- a/llvm/test/Transforms/InferAddressSpaces/AMDGPU/infer-address-space.ll -+++ b/llvm/test/Transforms/InferAddressSpaces/AMDGPU/infer-address-space.ll -@@ -166,10 +166,12 @@ exit: ; preds = %loop - } - - ; CHECK-LABEL: @select_bug( --; CHECK: %add.ptr157 = getelementptr inbounds i64, ptr undef, i64 select (i1 icmp ne (ptr inttoptr (i64 4873 to ptr), ptr null), i64 73, i64 93) -+; CHECK: %sel = select i1 icmp ne (ptr inttoptr (i64 4873 to ptr), ptr null), i64 73, i64 93 -+; CHECK: %add.ptr157 = getelementptr inbounds i64, ptr undef, i64 %sel - ; CHECK: %cmp169 = icmp uge ptr undef, %add.ptr157 - define void @select_bug() #0 { -- %add.ptr157 = getelementptr inbounds i64, ptr undef, i64 select (i1 icmp ne (ptr inttoptr (i64 4873 to ptr), ptr null), i64 73, i64 93) -+ %sel = select i1 icmp ne (ptr inttoptr (i64 4873 to ptr), ptr null), i64 73, i64 93 -+ %add.ptr157 = getelementptr inbounds i64, ptr undef, i64 %sel - %cmp169 = icmp uge ptr undef, %add.ptr157 - unreachable - } -diff --git a/llvm/test/Transforms/InferAddressSpaces/AMDGPU/select.ll b/llvm/test/Transforms/InferAddressSpaces/AMDGPU/select.ll -index 5562843a7dbf..9495c5566b36 100644 ---- a/llvm/test/Transforms/InferAddressSpaces/AMDGPU/select.ll -+++ b/llvm/test/Transforms/InferAddressSpaces/AMDGPU/select.ll -@@ -54,22 +54,6 @@ define amdgpu_kernel void @store_select_mismatch_group_private_flat(i1 %c, ptr a - @lds0 = internal addrspace(3) global i32 123, align 4 - @lds1 = internal addrspace(3) global i32 456, align 4 - --; CHECK-LABEL: @constexpr_select_group_flat( --; CHECK: %tmp = load i32, ptr addrspace(3) select (i1 icmp eq (i32 ptrtoint (ptr addrspace(3) @lds1 to i32), i32 4), ptr addrspace(3) @lds0, ptr addrspace(3) @lds1) --define i32 @constexpr_select_group_flat() #0 { --bb: -- %tmp = load i32, ptr select (i1 icmp eq (i32 ptrtoint (ptr addrspace(3) @lds1 to i32), i32 4), ptr addrspacecast (ptr addrspace(3) @lds0 to ptr), ptr addrspacecast (ptr addrspace(3) @lds1 to ptr)) -- ret i32 %tmp --} -- --; CHECK-LABEL: @constexpr_select_group_global_flat_mismatch( --; CHECK: %tmp = load i32, ptr select (i1 icmp eq (i32 ptrtoint (ptr addrspace(3) @lds1 to i32), i32 4), ptr addrspacecast (ptr addrspace(3) @lds0 to ptr), ptr addrspacecast (ptr addrspace(1) @global0 to ptr)) --define i32 @constexpr_select_group_global_flat_mismatch() #0 { --bb: -- %tmp = load i32, ptr select (i1 icmp eq (i32 ptrtoint (ptr addrspace(3) @lds1 to i32), i32 4), ptr addrspacecast (ptr addrspace(3) @lds0 to ptr), ptr addrspacecast (ptr addrspace(1) @global0 to ptr)) -- ret i32 %tmp --} -- - ; CHECK-LABEL: @store_select_group_flat_null( - ; CHECK: %select = select i1 %c, ptr addrspace(3) %group.ptr.0, ptr addrspace(3) addrspacecast (ptr null to ptr addrspace(3)) - ; CHECK: store i32 -1, ptr addrspace(3) %select -@@ -185,48 +169,6 @@ define amdgpu_kernel void @store_select_group_global_mismatch_null_null(i1 %c) # - ret void - } - --; CHECK-LABEL: @store_select_group_global_mismatch_null_null_constexpr( --; CHECK: store i32 7, ptr select (i1 icmp eq (i32 ptrtoint (ptr addrspace(3) @lds1 to i32), i32 4), ptr addrspacecast (ptr addrspace(3) null to ptr), ptr addrspacecast (ptr addrspace(1) null to ptr)), align 4 --define amdgpu_kernel void @store_select_group_global_mismatch_null_null_constexpr() #0 { -- store i32 7, ptr select (i1 icmp eq (i32 ptrtoint (ptr addrspace(3) @lds1 to i32), i32 4), ptr addrspacecast (ptr addrspace(3) null to ptr), ptr addrspacecast (ptr addrspace(1) null to ptr)), align 4 -- ret void --} -- --; CHECK-LABEL: @store_select_group_global_mismatch_gv_null_constexpr( --; CHECK: store i32 7, ptr select (i1 icmp eq (i32 ptrtoint (ptr addrspace(3) @lds1 to i32), i32 4), ptr addrspacecast (ptr addrspace(3) @lds0 to ptr), ptr addrspacecast (ptr addrspace(1) null to ptr)), align 4 --define amdgpu_kernel void @store_select_group_global_mismatch_gv_null_constexpr() #0 { -- store i32 7, ptr select (i1 icmp eq (i32 ptrtoint (ptr addrspace(3) @lds1 to i32), i32 4), ptr addrspacecast (ptr addrspace(3) @lds0 to ptr), ptr addrspacecast (ptr addrspace(1) null to ptr)), align 4 -- ret void --} -- --; CHECK-LABEL: @store_select_group_global_mismatch_null_gv_constexpr( --; CHECK: store i32 7, ptr select (i1 icmp eq (i32 ptrtoint (ptr addrspace(3) @lds1 to i32), i32 4), ptr addrspacecast (ptr addrspace(3) null to ptr), ptr addrspacecast (ptr addrspace(1) @global0 to ptr)), align 4 --define amdgpu_kernel void @store_select_group_global_mismatch_null_gv_constexpr() #0 { -- store i32 7, ptr select (i1 icmp eq (i32 ptrtoint (ptr addrspace(3) @lds1 to i32), i32 4), ptr addrspacecast (ptr addrspace(3) null to ptr), ptr addrspacecast (ptr addrspace(1) @global0 to ptr)), align 4 -- ret void --} -- --; CHECK-LABEL: @store_select_group_global_mismatch_inttoptr_null_constexpr( --; CHECK: store i32 7, ptr select (i1 icmp eq (i32 ptrtoint (ptr addrspace(3) @lds1 to i32), i32 4), ptr addrspacecast (ptr addrspace(3) inttoptr (i64 123 to ptr addrspace(3)) to ptr), ptr addrspacecast (ptr addrspace(1) null to ptr)), align 4 --define amdgpu_kernel void @store_select_group_global_mismatch_inttoptr_null_constexpr() #0 { -- store i32 7, ptr select (i1 icmp eq (i32 ptrtoint (ptr addrspace(3) @lds1 to i32), i32 4), ptr addrspacecast (ptr addrspace(3) inttoptr (i64 123 to ptr addrspace(3)) to ptr), ptr addrspacecast (ptr addrspace(1) null to ptr)), align 4 -- ret void --} -- --; CHECK-LABEL: @store_select_group_global_mismatch_inttoptr_flat_null_constexpr( --; CHECK: store i32 7, ptr addrspace(1) select (i1 icmp eq (i32 ptrtoint (ptr addrspace(3) @lds1 to i32), i32 4), ptr addrspace(1) addrspacecast (ptr inttoptr (i64 123 to ptr) to ptr addrspace(1)), ptr addrspace(1) null), align 4 --define amdgpu_kernel void @store_select_group_global_mismatch_inttoptr_flat_null_constexpr() #0 { -- store i32 7, ptr select (i1 icmp eq (i32 ptrtoint (ptr addrspace(3) @lds1 to i32), i32 4), ptr inttoptr (i64 123 to ptr), ptr addrspacecast (ptr addrspace(1) null to ptr)), align 4 -- ret void --} -- --; CHECK-LABEL: @store_select_group_global_mismatch_undef_undef_constexpr( --; CHECK: store i32 7, ptr select (i1 icmp eq (i32 ptrtoint (ptr addrspace(3) @lds1 to i32), i32 4), ptr addrspacecast (ptr addrspace(3) null to ptr), ptr undef), align 4 --define amdgpu_kernel void @store_select_group_global_mismatch_undef_undef_constexpr() #0 { -- store i32 7, ptr select (i1 icmp eq (i32 ptrtoint (ptr addrspace(3) @lds1 to i32), i32 4), ptr addrspacecast (ptr addrspace(3) null to ptr), ptr addrspacecast (ptr addrspace(1) undef to ptr)), align 4 -- ret void --} -- - @lds2 = external addrspace(3) global [1024 x i32], align 4 - - ; CHECK-LABEL: @store_select_group_constexpr_ptrtoint( -diff --git a/llvm/test/Transforms/InstCombine/2010-03-03-ExtElim.ll b/llvm/test/Transforms/InstCombine/2010-03-03-ExtElim.ll -index c9b2d6b41aa9..73fa613d0568 100644 ---- a/llvm/test/Transforms/InstCombine/2010-03-03-ExtElim.ll -+++ b/llvm/test/Transforms/InstCombine/2010-03-03-ExtElim.ll -@@ -21,12 +21,19 @@ define i1 @PR6486() nounwind { - - define i1 @PR16462_1() nounwind { - ; CHECK-LABEL: @PR16462_1( -- ret i1 icmp sgt (i32 sext (i16 trunc (i32 select (i1 icmp eq (ptr @a, ptr @d), i32 0, i32 1) to i16) to i32), i32 65535) -+ %constexpr = select i1 icmp eq (ptr @a, ptr @d), i32 0, i32 1 -+ %constexpr1 = trunc i32 %constexpr to i16 -+ %constexpr2 = sext i16 %constexpr1 to i32 -+ %constexpr3 = icmp sgt i32 %constexpr2, 65535 -+ ret i1 %constexpr3 - ; CHECK: ret i1 false - } - - define i1 @PR16462_2() nounwind { - ; CHECK-LABEL: @PR16462_2( -- ret i1 icmp sgt (i32 sext (i16 trunc (i32 select (i1 icmp eq (ptr @a, ptr @d), i32 0, i32 1) to i16) to i32), i32 42) -+ %constexpr = select i1 icmp eq (ptr @a, ptr @d), i32 0, i32 1 -+ %constexpr1 = trunc i32 %constexpr to i16 -+ %constexpr2 = icmp sgt i16 %constexpr1, 42 -+ ret i1 %constexpr2 - ; CHECK: ret i1 false - } -diff --git a/llvm/test/Transforms/InstCombine/cast.ll b/llvm/test/Transforms/InstCombine/cast.ll -index cd3b032d739d..5b480b115793 100644 ---- a/llvm/test/Transforms/InstCombine/cast.ll -+++ b/llvm/test/Transforms/InstCombine/cast.ll -@@ -1441,7 +1441,8 @@ define i64 @PR28745() { - ; LE-LABEL: @PR28745( - ; LE-NEXT: ret i64 0 - ; -- %e = extractvalue { i32 } select (i1 icmp eq (i16 extractelement (<2 x i16> bitcast (<1 x i32> <i32 1> to <2 x i16>), i32 0), i16 0), { i32 } { i32 1 }, { i32 } zeroinitializer), 0 -+ %s = select i1 icmp eq (i16 extractelement (<2 x i16> bitcast (<1 x i32> <i32 1> to <2 x i16>), i32 0), i16 0), { i32 } { i32 1 }, { i32 } zeroinitializer -+ %e = extractvalue { i32 } %s, 0 - %b = zext i32 %e to i64 - ret i64 %b - } -diff --git a/llvm/test/Transforms/InstCombine/pr28725.ll b/llvm/test/Transforms/InstCombine/pr28725.ll -index 26772eb7fe3a..688409c41f3c 100644 ---- a/llvm/test/Transforms/InstCombine/pr28725.ll -+++ b/llvm/test/Transforms/InstCombine/pr28725.ll -@@ -3,7 +3,8 @@ - - define <2 x i16> @test1() { - entry: -- %e = extractvalue %S select (i1 icmp eq (i16 extractelement (<2 x i16> bitcast (<1 x i32> <i32 1> to <2 x i16>), i32 0), i16 0), %S zeroinitializer, %S { i16 0, i32 1 }), 0 -+ %s = select i1 icmp eq (i16 extractelement (<2 x i16> bitcast (<1 x i32> <i32 1> to <2 x i16>), i32 0), i16 0), %S zeroinitializer, %S { i16 0, i32 1 } -+ %e = extractvalue %S %s, 0 - %b = insertelement <2 x i16> <i16 undef, i16 0>, i16 %e, i32 0 - ret <2 x i16> %b - } -diff --git a/llvm/test/Transforms/InstSimplify/ConstProp/constant-expr.ll b/llvm/test/Transforms/InstSimplify/ConstProp/constant-expr.ll -index 8978d9200afb..bdecda847d37 100644 ---- a/llvm/test/Transforms/InstSimplify/ConstProp/constant-expr.ll -+++ b/llvm/test/Transforms/InstSimplify/ConstProp/constant-expr.ll -@@ -84,12 +84,3 @@ - ; CHECK: pr9011_14 = constant i128 0 - @pr9011_15 = constant i128 bitcast (<4 x i32> zeroinitializer to i128) - ; CHECK: pr9011_15 = constant i128 0 -- --@select = internal constant -- i32 select (i1 icmp ult (i32 ptrtoint (ptr @X to i32), -- i32 ptrtoint (ptr @Y to i32)), -- i32 select (i1 icmp ult (i32 ptrtoint (ptr @X to i32), -- i32 ptrtoint (ptr @Y to i32)), -- i32 10, i32 20), -- i32 30) --; CHECK: select = internal constant i32 select {{.*}} i32 10, i32 30 -diff --git a/llvm/test/Transforms/InstSimplify/pr28725.ll b/llvm/test/Transforms/InstSimplify/pr28725.ll -index 67e6170c4f1b..8adfecc5128e 100644 ---- a/llvm/test/Transforms/InstSimplify/pr28725.ll -+++ b/llvm/test/Transforms/InstSimplify/pr28725.ll -@@ -6,12 +6,14 @@ - define <2 x i16> @test1() { - ; CHECK-LABEL: @test1( - ; CHECK-NEXT: entry: --; CHECK-NEXT: [[E:%.*]] = extractvalue [[S:%.*]] select (i1 icmp eq (i16 extractelement (<2 x i16> bitcast (<1 x i32> <i32 1> to <2 x i16>), i32 0), i16 0), [[S]] zeroinitializer, [[S]] { i16 0, i32 1 }), 0 -+; CHECK-NEXT: [[SEL:%.*]] = select i1 icmp eq (i16 extractelement (<2 x i16> bitcast (<1 x i32> <i32 1> to <2 x i16>), i32 0), i16 0), [[S:%.*]] zeroinitializer, [[S]] { i16 0, i32 1 } -+; CHECK-NEXT: [[E:%.*]] = extractvalue [[S]] [[SEL]], 0 - ; CHECK-NEXT: [[B:%.*]] = insertelement <2 x i16> <i16 undef, i16 0>, i16 [[E]], i32 0 - ; CHECK-NEXT: ret <2 x i16> [[B]] - ; - entry: -- %e = extractvalue %S select (i1 icmp eq (i16 extractelement (<2 x i16> bitcast (<1 x i32> <i32 1> to <2 x i16>), i32 0), i16 0), %S zeroinitializer, %S { i16 0, i32 1 }), 0 -+ %sel = select i1 icmp eq (i16 extractelement (<2 x i16> bitcast (<1 x i32> <i32 1> to <2 x i16>), i32 0), i16 0), %S zeroinitializer, %S { i16 0, i32 1 } -+ %e = extractvalue %S %sel, 0 - %b = insertelement <2 x i16> <i16 undef, i16 0>, i16 %e, i32 0 - ret <2 x i16> %b - } -diff --git a/llvm/unittests/Analysis/ValueTrackingTest.cpp b/llvm/unittests/Analysis/ValueTrackingTest.cpp -index ef130522f10f..713cfed808f1 100644 ---- a/llvm/unittests/Analysis/ValueTrackingTest.cpp -+++ b/llvm/unittests/Analysis/ValueTrackingTest.cpp -@@ -1157,10 +1157,7 @@ TEST(ValueTracking, canCreatePoisonOrUndef) { - {{false, false}, "call noundef i32 @g(i32 %x)"}, - {{true, false}, "fcmp nnan oeq float %fx, %fy"}, - {{false, false}, "fcmp oeq float %fx, %fy"}, -- {{true, false}, -- "ashr <4 x i32> %vx, select (i1 icmp sgt (i32 ptrtoint (i32* @s to " -- "i32), i32 1), <4 x i32> zeroinitializer, <4 x i32> <i32 0, i32 1, i32 " -- "2, i32 3>)"}, -+ {{true, false}, "ashr i32 %x, ptrtoint (i32* @s to i32)"}, - {{false, false}, - "call {i32, i1} @llvm.sadd.with.overflow.i32(i32 %x, i32 %y)"}, - {{false, false}, -diff --git a/llvm/unittests/IR/ConstantsTest.cpp b/llvm/unittests/IR/ConstantsTest.cpp -index 71ff311e7693..947cc7f89243 100644 ---- a/llvm/unittests/IR/ConstantsTest.cpp -+++ b/llvm/unittests/IR/ConstantsTest.cpp -@@ -270,8 +270,6 @@ TEST(ConstantsTest, AsInstructionsTest) { - CHECK(ConstantExpr::getFPExtend(P1, DoubleTy), - "fpext float " P1STR " to double"); - -- CHECK(ConstantExpr::getSelect(P3, P0, P4), -- "select i1 " P3STR ", i32 " P0STR ", i32 " P4STR); - CHECK(ConstantExpr::getICmp(CmpInst::ICMP_EQ, P0, P4), - "icmp eq i32 " P0STR ", " P4STR); - CHECK(ConstantExpr::getFCmp(CmpInst::FCMP_ULT, P1, P5), --- -2.40.0 - diff --git a/0010-docs-Mention-removal-of-legacy-optimization-pipeline.patch b/0010-docs-Mention-removal-of-legacy-optimization-pipeline.patch deleted file mode 100644 index 1316f3306e74..000000000000 --- a/0010-docs-Mention-removal-of-legacy-optimization-pipeline.patch +++ /dev/null @@ -1,36 +0,0 @@ -From a63270cda814a924f0ce35592a73dfd9f497ee00 Mon Sep 17 00:00:00 2001 -From: Arthur Eubanks <aeubanks@google.com> -Date: Thu, 16 Mar 2023 10:05:34 -0700 -Subject: [PATCH] [docs] Mention removal of legacy optimization pipeline and - inliner alloca merging - -Reviewed By: asbirlea - -Differential Revision: https://reviews.llvm.org/D146243 ---- - llvm/docs/ReleaseNotes.rst | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst -index 56da5be434eb..2fe22e855f53 100644 ---- a/llvm/docs/ReleaseNotes.rst -+++ b/llvm/docs/ReleaseNotes.rst -@@ -61,6 +61,15 @@ Changes to the LLVM IR - - * ``select`` - -+Changes to LLVM infrastructure -+----------------------------- -+ -+* The legacy optimization pipeline has been removed. -+ -+* Alloca merging in the inliner has been removed, since it only worked with the -+ legacy inliner pass. Backend stack coloring should handle cases alloca -+ merging initially set out to handle. -+ - Changes to building LLVM - ------------------------ - --- -2.40.0 - diff --git a/0011-Fix-LLVM-Sphinx-build.patch b/0011-Fix-LLVM-Sphinx-build.patch deleted file mode 100644 index fda7d07cdbb5..000000000000 --- a/0011-Fix-LLVM-Sphinx-build.patch +++ /dev/null @@ -1,27 +0,0 @@ -From d73c51bfda3719e698ef2e7ed973909d7138d882 Mon Sep 17 00:00:00 2001 -From: Aaron Ballman <aaron@aaronballman.com> -Date: Thu, 16 Mar 2023 14:03:04 -0400 -Subject: [PATCH] Fix LLVM Sphinx build - -This addresses the issue found by: -https://lab.llvm.org/buildbot/#/builders/30/builds/33006 ---- - llvm/docs/ReleaseNotes.rst | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst -index 2fe22e855f53..e0da56da6b69 100644 ---- a/llvm/docs/ReleaseNotes.rst -+++ b/llvm/docs/ReleaseNotes.rst -@@ -62,7 +62,7 @@ Changes to the LLVM IR - * ``select`` - - Changes to LLVM infrastructure ------------------------------- -+------------------------------ - - * The legacy optimization pipeline has been removed. - --- -2.40.0 - diff --git a/0012-Passes-Remove-some-legacy-passes.patch b/0012-Passes-Remove-some-legacy-passes.patch deleted file mode 100644 index 7e19944bf303..000000000000 --- a/0012-Passes-Remove-some-legacy-passes.patch +++ /dev/null @@ -1,487 +0,0 @@ -From 1a90faacf1502fb967900ab44b62e8509a369013 Mon Sep 17 00:00:00 2001 -From: Arthur Eubanks <aeubanks@google.com> -Date: Mon, 13 Mar 2023 09:53:50 -0700 -Subject: [PATCH] [Passes] Remove some legacy passes - -NewGVN -GVNHoist -GVNSink -MemCpyOpt -Float2Int - -These were only used for the optimization pipeline, of which the legacy version was removed. ---- - llvm/include/llvm/InitializePasses.h | 5 -- - llvm/include/llvm/LinkAllPasses.h | 4 -- - llvm/include/llvm/Transforms/Scalar.h | 34 ---------- - llvm/lib/Transforms/Scalar/Float2Int.cpp | 33 ---------- - llvm/lib/Transforms/Scalar/GVNHoist.cpp | 47 -------------- - llvm/lib/Transforms/Scalar/GVNSink.cpp | 34 ---------- - .../lib/Transforms/Scalar/MemCpyOptimizer.cpp | 62 ------------------- - llvm/lib/Transforms/Scalar/NewGVN.cpp | 55 ---------------- - llvm/lib/Transforms/Scalar/Scalar.cpp | 5 -- - 9 files changed, 279 deletions(-) - -diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h -index 64a9f7b47112..7bf013f43d1b 100644 ---- a/llvm/include/llvm/InitializePasses.h -+++ b/llvm/include/llvm/InitializePasses.h -@@ -136,14 +136,11 @@ void initializeFinalizeMachineBundlesPass(PassRegistry&); - void initializeFixIrreduciblePass(PassRegistry &); - void initializeFixupStatepointCallerSavedPass(PassRegistry&); - void initializeFlattenCFGLegacyPassPass(PassRegistry &); --void initializeFloat2IntLegacyPassPass(PassRegistry&); - void initializeForceFunctionAttrsLegacyPassPass(PassRegistry&); - void initializeFuncletLayoutPass(PassRegistry&); - void initializeGCMachineCodeAnalysisPass(PassRegistry&); - void initializeGCModuleInfoPass(PassRegistry&); --void initializeGVNHoistLegacyPassPass(PassRegistry&); - void initializeGVNLegacyPassPass(PassRegistry&); --void initializeGVNSinkLegacyPassPass(PassRegistry&); - void initializeGlobalDCELegacyPassPass(PassRegistry&); - void initializeGlobalMergePass(PassRegistry&); - void initializeGlobalOptLegacyPassPass(PassRegistry&); -@@ -260,7 +257,6 @@ void initializeMachineTraceMetricsPass(PassRegistry&); - void initializeMachineUniformityInfoPrinterPassPass(PassRegistry &); - void initializeMachineUniformityAnalysisPassPass(PassRegistry &); - void initializeMachineVerifierPassPass(PassRegistry&); --void initializeMemCpyOptLegacyPassPass(PassRegistry&); - void initializeMemDepPrinterPass(PassRegistry&); - void initializeMemDerefPrinterPass(PassRegistry&); - void initializeMemoryDependenceWrapperPassPass(PassRegistry&); -@@ -275,7 +271,6 @@ void initializeModuloScheduleTestPass(PassRegistry&); - void initializeMustExecutePrinterPass(PassRegistry&); - void initializeMustBeExecutedContextPrinterPass(PassRegistry&); - void initializeNaryReassociateLegacyPassPass(PassRegistry&); --void initializeNewGVNLegacyPassPass(PassRegistry&); - void initializeObjCARCContractLegacyPassPass(PassRegistry &); - void initializeOptimizationRemarkEmitterWrapperPassPass(PassRegistry&); - void initializeOptimizePHIsPass(PassRegistry&); -diff --git a/llvm/include/llvm/LinkAllPasses.h b/llvm/include/llvm/LinkAllPasses.h -index 9e16054bfb9f..55d2a35ca353 100644 ---- a/llvm/include/llvm/LinkAllPasses.h -+++ b/llvm/include/llvm/LinkAllPasses.h -@@ -138,11 +138,8 @@ namespace { - (void) llvm::createConstantHoistingPass(); - (void) llvm::createCodeGenPreparePass(); - (void) llvm::createEarlyCSEPass(); -- (void) llvm::createGVNHoistPass(); - (void) llvm::createMergedLoadStoreMotionPass(); - (void) llvm::createGVNPass(); -- (void) llvm::createNewGVNPass(); -- (void) llvm::createMemCpyOptPass(); - (void) llvm::createPostDomTree(); - (void) llvm::createInstructionNamerPass(); - (void) llvm::createMetaRenamerPass(); -@@ -170,7 +167,6 @@ namespace { - (void) llvm::createMemDerefPrinter(); - (void) llvm::createMustExecutePrinter(); - (void) llvm::createMustBeExecutedContextPrinter(); -- (void) llvm::createFloat2IntPass(); - (void)llvm::createScalarizeMaskedMemIntrinLegacyPass(); - (void) llvm::createHardwareLoopsLegacyPass(); - (void) llvm::createInjectTLIMappingsLegacyPass(); -diff --git a/llvm/include/llvm/Transforms/Scalar.h b/llvm/include/llvm/Transforms/Scalar.h -index e9b6dc40c913..c188df4b248f 100644 ---- a/llvm/include/llvm/Transforms/Scalar.h -+++ b/llvm/include/llvm/Transforms/Scalar.h -@@ -205,20 +205,6 @@ FunctionPass *createTailCallEliminationPass(); - // - FunctionPass *createEarlyCSEPass(bool UseMemorySSA = false); - --//===----------------------------------------------------------------------===// --// --// GVNHoist - This pass performs a simple and fast GVN pass over the dominator --// tree to hoist common expressions from sibling branches. --// --FunctionPass *createGVNHoistPass(); -- --//===----------------------------------------------------------------------===// --// --// GVNSink - This pass uses an "inverted" value numbering to decide the --// similarity of expressions and sinks similar expressions into successors. --// --FunctionPass *createGVNSinkPass(); -- - //===----------------------------------------------------------------------===// - // - // MergedLoadStoreMotion - This pass merges loads and stores in diamonds. Loads -@@ -226,20 +212,6 @@ FunctionPass *createGVNSinkPass(); - // - FunctionPass *createMergedLoadStoreMotionPass(bool SplitFooterBB = false); - --//===----------------------------------------------------------------------===// --// --// GVN - This pass performs global value numbering and redundant load --// elimination cotemporaneously. --// --FunctionPass *createNewGVNPass(); -- --//===----------------------------------------------------------------------===// --// --// MemCpyOpt - This pass performs optimizations related to eliminating memcpy --// calls and/or combining multiple stores into memset's. --// --FunctionPass *createMemCpyOptPass(); -- - //===----------------------------------------------------------------------===// - // - // ConstantHoisting - This pass prepares a function for expensive constants. -@@ -366,12 +338,6 @@ FunctionPass *createPlaceSafepointsPass(); - // - ModulePass *createRewriteStatepointsForGCLegacyPass(); - --//===----------------------------------------------------------------------===// --// --// Float2Int - Demote floats to ints where possible. --// --FunctionPass *createFloat2IntPass(); -- - //===----------------------------------------------------------------------===// - // - // NaryReassociate - Simplify n-ary operations by reassociation. -diff --git a/llvm/lib/Transforms/Scalar/Float2Int.cpp b/llvm/lib/Transforms/Scalar/Float2Int.cpp -index 149d0dee2428..35123606a15d 100644 ---- a/llvm/lib/Transforms/Scalar/Float2Int.cpp -+++ b/llvm/lib/Transforms/Scalar/Float2Int.cpp -@@ -49,35 +49,6 @@ MaxIntegerBW("float2int-max-integer-bw", cl::init(64), cl::Hidden, - cl::desc("Max integer bitwidth to consider in float2int" - "(default=64)")); - --namespace { -- struct Float2IntLegacyPass : public FunctionPass { -- static char ID; // Pass identification, replacement for typeid -- Float2IntLegacyPass() : FunctionPass(ID) { -- initializeFloat2IntLegacyPassPass(*PassRegistry::getPassRegistry()); -- } -- -- bool runOnFunction(Function &F) override { -- if (skipFunction(F)) -- return false; -- -- const DominatorTree &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree(); -- return Impl.runImpl(F, DT); -- } -- -- void getAnalysisUsage(AnalysisUsage &AU) const override { -- AU.setPreservesCFG(); -- AU.addRequired<DominatorTreeWrapperPass>(); -- AU.addPreserved<GlobalsAAWrapperPass>(); -- } -- -- private: -- Float2IntPass Impl; -- }; --} -- --char Float2IntLegacyPass::ID = 0; --INITIALIZE_PASS(Float2IntLegacyPass, "float2int", "Float to int", false, false) -- - // Given a FCmp predicate, return a matching ICmp predicate if one - // exists, otherwise return BAD_ICMP_PREDICATE. - static CmpInst::Predicate mapFCmpPred(CmpInst::Predicate P) { -@@ -529,9 +500,6 @@ bool Float2IntPass::runImpl(Function &F, const DominatorTree &DT) { - return Modified; - } - --namespace llvm { --FunctionPass *createFloat2IntPass() { return new Float2IntLegacyPass(); } -- - PreservedAnalyses Float2IntPass::run(Function &F, FunctionAnalysisManager &AM) { - const DominatorTree &DT = AM.getResult<DominatorTreeAnalysis>(F); - if (!runImpl(F, DT)) -@@ -541,4 +509,3 @@ PreservedAnalyses Float2IntPass::run(Function &F, FunctionAnalysisManager &AM) { - PA.preserveSet<CFGAnalyses>(); - return PA; - } --} // End namespace llvm -diff --git a/llvm/lib/Transforms/Scalar/GVNHoist.cpp b/llvm/lib/Transforms/Scalar/GVNHoist.cpp -index abe38aa2a357..4e290015bc5e 100644 ---- a/llvm/lib/Transforms/Scalar/GVNHoist.cpp -+++ b/llvm/lib/Transforms/Scalar/GVNHoist.cpp -@@ -519,39 +519,6 @@ private: - std::pair<unsigned, unsigned> hoistExpressions(Function &F); - }; - --class GVNHoistLegacyPass : public FunctionPass { --public: -- static char ID; -- -- GVNHoistLegacyPass() : FunctionPass(ID) { -- initializeGVNHoistLegacyPassPass(*PassRegistry::getPassRegistry()); -- } -- -- bool runOnFunction(Function &F) override { -- if (skipFunction(F)) -- return false; -- auto &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree(); -- auto &PDT = getAnalysis<PostDominatorTreeWrapperPass>().getPostDomTree(); -- auto &AA = getAnalysis<AAResultsWrapperPass>().getAAResults(); -- auto &MD = getAnalysis<MemoryDependenceWrapperPass>().getMemDep(); -- auto &MSSA = getAnalysis<MemorySSAWrapperPass>().getMSSA(); -- -- GVNHoist G(&DT, &PDT, &AA, &MD, &MSSA); -- return G.run(F); -- } -- -- void getAnalysisUsage(AnalysisUsage &AU) const override { -- AU.addRequired<DominatorTreeWrapperPass>(); -- AU.addRequired<PostDominatorTreeWrapperPass>(); -- AU.addRequired<AAResultsWrapperPass>(); -- AU.addRequired<MemoryDependenceWrapperPass>(); -- AU.addRequired<MemorySSAWrapperPass>(); -- AU.addPreserved<DominatorTreeWrapperPass>(); -- AU.addPreserved<MemorySSAWrapperPass>(); -- AU.addPreserved<GlobalsAAWrapperPass>(); -- } --}; -- - bool GVNHoist::run(Function &F) { - NumFuncArgs = F.arg_size(); - VN.setDomTree(DT); -@@ -1256,17 +1223,3 @@ PreservedAnalyses GVNHoistPass::run(Function &F, FunctionAnalysisManager &AM) { - PA.preserve<MemorySSAAnalysis>(); - return PA; - } -- --char GVNHoistLegacyPass::ID = 0; -- --INITIALIZE_PASS_BEGIN(GVNHoistLegacyPass, "gvn-hoist", -- "Early GVN Hoisting of Expressions", false, false) --INITIALIZE_PASS_DEPENDENCY(MemoryDependenceWrapperPass) --INITIALIZE_PASS_DEPENDENCY(MemorySSAWrapperPass) --INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass) --INITIALIZE_PASS_DEPENDENCY(PostDominatorTreeWrapperPass) --INITIALIZE_PASS_DEPENDENCY(AAResultsWrapperPass) --INITIALIZE_PASS_END(GVNHoistLegacyPass, "gvn-hoist", -- "Early GVN Hoisting of Expressions", false, false) -- --FunctionPass *llvm::createGVNHoistPass() { return new GVNHoistLegacyPass(); } -diff --git a/llvm/lib/Transforms/Scalar/GVNSink.cpp b/llvm/lib/Transforms/Scalar/GVNSink.cpp -index 5fb8a77051fb..34a9aaf4066e 100644 ---- a/llvm/lib/Transforms/Scalar/GVNSink.cpp -+++ b/llvm/lib/Transforms/Scalar/GVNSink.cpp -@@ -886,29 +886,6 @@ void GVNSink::sinkLastInstruction(ArrayRef<BasicBlock *> Blocks, - NumRemoved += Insts.size() - 1; - } - --//////////////////////////////////////////////////////////////////////////////// --// Pass machinery / boilerplate -- --class GVNSinkLegacyPass : public FunctionPass { --public: -- static char ID; -- -- GVNSinkLegacyPass() : FunctionPass(ID) { -- initializeGVNSinkLegacyPassPass(*PassRegistry::getPassRegistry()); -- } -- -- bool runOnFunction(Function &F) override { -- if (skipFunction(F)) -- return false; -- GVNSink G; -- return G.run(F); -- } -- -- void getAnalysisUsage(AnalysisUsage &AU) const override { -- AU.addPreserved<GlobalsAAWrapperPass>(); -- } --}; -- - } // end anonymous namespace - - PreservedAnalyses GVNSinkPass::run(Function &F, FunctionAnalysisManager &AM) { -@@ -917,14 +894,3 @@ PreservedAnalyses GVNSinkPass::run(Function &F, FunctionAnalysisManager &AM) { - return PreservedAnalyses::all(); - return PreservedAnalyses::none(); - } -- --char GVNSinkLegacyPass::ID = 0; -- --INITIALIZE_PASS_BEGIN(GVNSinkLegacyPass, "gvn-sink", -- "Early GVN sinking of Expressions", false, false) --INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass) --INITIALIZE_PASS_DEPENDENCY(PostDominatorTreeWrapperPass) --INITIALIZE_PASS_END(GVNSinkLegacyPass, "gvn-sink", -- "Early GVN sinking of Expressions", false, false) -- --FunctionPass *llvm::createGVNSinkPass() { return new GVNSinkLegacyPass(); } -diff --git a/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp b/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp -index 64846484f936..1a83c713092d 100644 ---- a/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp -+++ b/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp -@@ -255,54 +255,6 @@ void MemsetRanges::addRange(int64_t Start, int64_t Size, Value *Ptr, - // MemCpyOptLegacyPass Pass - //===----------------------------------------------------------------------===// - --namespace { -- --class MemCpyOptLegacyPass : public FunctionPass { -- MemCpyOptPass Impl; -- --public: -- static char ID; // Pass identification, replacement for typeid -- -- MemCpyOptLegacyPass() : FunctionPass(ID) { -- initializeMemCpyOptLegacyPassPass(*PassRegistry::getPassRegistry()); -- } -- -- bool runOnFunction(Function &F) override; -- --private: -- // This transformation requires dominator postdominator info -- void getAnalysisUsage(AnalysisUsage &AU) const override { -- AU.setPreservesCFG(); -- AU.addRequired<AssumptionCacheTracker>(); -- AU.addRequired<DominatorTreeWrapperPass>(); -- AU.addPreserved<DominatorTreeWrapperPass>(); -- AU.addPreserved<GlobalsAAWrapperPass>(); -- AU.addRequired<TargetLibraryInfoWrapperPass>(); -- AU.addRequired<AAResultsWrapperPass>(); -- AU.addPreserved<AAResultsWrapperPass>(); -- AU.addRequired<MemorySSAWrapperPass>(); -- AU.addPreserved<MemorySSAWrapperPass>(); -- } --}; -- --} // end anonymous namespace -- --char MemCpyOptLegacyPass::ID = 0; -- --/// The public interface to this file... --FunctionPass *llvm::createMemCpyOptPass() { return new MemCpyOptLegacyPass(); } -- --INITIALIZE_PASS_BEGIN(MemCpyOptLegacyPass, "memcpyopt", "MemCpy Optimization", -- false, false) --INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker) --INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass) --INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass) --INITIALIZE_PASS_DEPENDENCY(AAResultsWrapperPass) --INITIALIZE_PASS_DEPENDENCY(GlobalsAAWrapperPass) --INITIALIZE_PASS_DEPENDENCY(MemorySSAWrapperPass) --INITIALIZE_PASS_END(MemCpyOptLegacyPass, "memcpyopt", "MemCpy Optimization", -- false, false) -- - // Check that V is either not accessible by the caller, or unwinding cannot - // occur between Start and End. - static bool mayBeVisibleThroughUnwinding(Value *V, Instruction *Start, -@@ -1730,17 +1682,3 @@ bool MemCpyOptPass::runImpl(Function &F, TargetLibraryInfo *TLI_, - - return MadeChange; - } -- --/// This is the main transformation entry point for a function. --bool MemCpyOptLegacyPass::runOnFunction(Function &F) { -- if (skipFunction(F)) -- return false; -- -- auto *TLI = &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(F); -- auto *AA = &getAnalysis<AAResultsWrapperPass>().getAAResults(); -- auto *AC = &getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F); -- auto *DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree(); -- auto *MSSA = &getAnalysis<MemorySSAWrapperPass>().getMSSA(); -- -- return Impl.runImpl(F, TLI, AA, AC, DT, MSSA); --} -diff --git a/llvm/lib/Transforms/Scalar/NewGVN.cpp b/llvm/lib/Transforms/Scalar/NewGVN.cpp -index d3dba0c5f1d5..92e9becf7afb 100644 ---- a/llvm/lib/Transforms/Scalar/NewGVN.cpp -+++ b/llvm/lib/Transforms/Scalar/NewGVN.cpp -@@ -4208,61 +4208,6 @@ bool NewGVN::shouldSwapOperandsForIntrinsic(const Value *A, const Value *B, - return false; - } - --namespace { -- --class NewGVNLegacyPass : public FunctionPass { --public: -- // Pass identification, replacement for typeid. -- static char ID; -- -- NewGVNLegacyPass() : FunctionPass(ID) { -- initializeNewGVNLegacyPassPass(*PassRegistry::getPassRegistry()); -- } -- -- bool runOnFunction(Function &F) override; -- --private: -- void getAnalysisUsage(AnalysisUsage &AU) const override { -- AU.addRequired<AssumptionCacheTracker>(); -- AU.addRequired<DominatorTreeWrapperPass>(); -- AU.addRequired<TargetLibraryInfoWrapperPass>(); -- AU.addRequired<MemorySSAWrapperPass>(); -- AU.addRequired<AAResultsWrapperPass>(); -- AU.addPreserved<DominatorTreeWrapperPass>(); -- AU.addPreserved<GlobalsAAWrapperPass>(); -- } --}; -- --} // end anonymous namespace -- --bool NewGVNLegacyPass::runOnFunction(Function &F) { -- if (skipFunction(F)) -- return false; -- return NewGVN(F, &getAnalysis<DominatorTreeWrapperPass>().getDomTree(), -- &getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F), -- &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(F), -- &getAnalysis<AAResultsWrapperPass>().getAAResults(), -- &getAnalysis<MemorySSAWrapperPass>().getMSSA(), -- F.getParent()->getDataLayout()) -- .runGVN(); --} -- --char NewGVNLegacyPass::ID = 0; -- --INITIALIZE_PASS_BEGIN(NewGVNLegacyPass, "newgvn", "Global Value Numbering", -- false, false) --INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker) --INITIALIZE_PASS_DEPENDENCY(MemorySSAWrapperPass) --INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass) --INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass) --INITIALIZE_PASS_DEPENDENCY(AAResultsWrapperPass) --INITIALIZE_PASS_DEPENDENCY(GlobalsAAWrapperPass) --INITIALIZE_PASS_END(NewGVNLegacyPass, "newgvn", "Global Value Numbering", false, -- false) -- --// createGVNPass - The public interface to this file. --FunctionPass *llvm::createNewGVNPass() { return new NewGVNLegacyPass(); } -- - PreservedAnalyses NewGVNPass::run(Function &F, AnalysisManager<Function> &AM) { - // Apparently the order in which we get these results matter for - // the old GVN (see Chandler's comment in GVN.cpp). I'll keep -diff --git a/llvm/lib/Transforms/Scalar/Scalar.cpp b/llvm/lib/Transforms/Scalar/Scalar.cpp -index 26a1e22f3317..5c8018956b43 100644 ---- a/llvm/lib/Transforms/Scalar/Scalar.cpp -+++ b/llvm/lib/Transforms/Scalar/Scalar.cpp -@@ -38,12 +38,9 @@ void llvm::initializeScalarOpts(PassRegistry &Registry) { - initializeGuardWideningLegacyPassPass(Registry); - initializeLoopGuardWideningLegacyPassPass(Registry); - initializeGVNLegacyPassPass(Registry); -- initializeNewGVNLegacyPassPass(Registry); - initializeEarlyCSELegacyPassPass(Registry); - initializeEarlyCSEMemSSALegacyPassPass(Registry); - initializeMakeGuardsExplicitLegacyPassPass(Registry); -- initializeGVNHoistLegacyPassPass(Registry); -- initializeGVNSinkLegacyPassPass(Registry); - initializeFlattenCFGLegacyPassPass(Registry); - initializeIRCELegacyPassPass(Registry); - initializeInferAddressSpacesPass(Registry); -@@ -64,7 +61,6 @@ void llvm::initializeScalarOpts(PassRegistry &Registry) { - initializeLowerMatrixIntrinsicsLegacyPassPass(Registry); - initializeLowerMatrixIntrinsicsMinimalLegacyPassPass(Registry); - initializeLowerWidenableConditionLegacyPassPass(Registry); -- initializeMemCpyOptLegacyPassPass(Registry); - initializeMergeICmpsLegacyPassPass(Registry); - initializeMergedLoadStoreMotionLegacyPassPass(Registry); - initializeNaryReassociateLegacyPassPass(Registry); -@@ -86,7 +82,6 @@ void llvm::initializeScalarOpts(PassRegistry &Registry) { - initializeStraightLineStrengthReduceLegacyPassPass(Registry); - initializePlaceBackedgeSafepointsLegacyPassPass(Registry); - initializePlaceSafepointsLegacyPassPass(Registry); -- initializeFloat2IntLegacyPassPass(Registry); - initializeLoopSimplifyCFGLegacyPassPass(Registry); - } - --- -2.40.0 - diff --git a/0013-opt-Rename-enable-new-pm-bugpoint-enable-legacy-pm.patch b/0013-opt-Rename-enable-new-pm-bugpoint-enable-legacy-pm.patch deleted file mode 100644 index befc1ae59971..000000000000 --- a/0013-opt-Rename-enable-new-pm-bugpoint-enable-legacy-pm.patch +++ /dev/null @@ -1,176 +0,0 @@ -From c1b4240322bfaa43b7f02ca58cf9fe52744884b9 Mon Sep 17 00:00:00 2001 -From: Arthur Eubanks <aeubanks@google.com> -Date: Tue, 14 Mar 2023 16:23:53 -0700 -Subject: [PATCH] [opt] Rename -enable-new-pm -> -bugpoint-enable-legacy-pm - --enable-new-pm is no longer necessary except for bugpoint. Make the name more clunky so it hopefully won't be used. - -Reviewed By: nikic - -Differential Revision: https://reviews.llvm.org/D146103 ---- - llvm/docs/NewPassManager.rst | 11 ----------- - llvm/docs/WritingAnLLVMPass.rst | 7 +++---- - llvm/test/BugPoint/unsymbolized.ll | 2 +- - llvm/test/Feature/load_extension.ll | 4 ---- - llvm/test/Other/opt-On.ll | 13 ------------- - .../Other/opt-legacy-syntax-deprecation.ll | 1 - - llvm/tools/bugpoint/OptimizerDriver.cpp | 2 +- - llvm/tools/opt/opt.cpp | 19 ++++++++----------- - 8 files changed, 13 insertions(+), 46 deletions(-) - -diff --git a/llvm/docs/NewPassManager.rst b/llvm/docs/NewPassManager.rst -index d115c4dbc401..7464110daa09 100644 ---- a/llvm/docs/NewPassManager.rst -+++ b/llvm/docs/NewPassManager.rst -@@ -420,17 +420,6 @@ for more details. - Invoking ``opt`` - ================ - --To use the legacy pass manager: -- --.. code-block:: shell -- -- $ opt -enable-new-pm=0 -pass1 -pass2 /tmp/a.ll -S -- --This will be removed once the legacy pass manager is deprecated and removed for --the optimization pipeline. -- --To use the new PM: -- - .. code-block:: shell - - $ opt -passes='pass1,pass2' /tmp/a.ll -S -diff --git a/llvm/docs/WritingAnLLVMPass.rst b/llvm/docs/WritingAnLLVMPass.rst -index 1e92be87e2e9..3e6063e58334 100644 ---- a/llvm/docs/WritingAnLLVMPass.rst -+++ b/llvm/docs/WritingAnLLVMPass.rst -@@ -36,11 +36,10 @@ advanced features are discussed. - - .. warning:: - This document deals with the legacy pass manager. LLVM uses the new pass -- manager by default for the optimization pipeline (the codegen pipeline is -- still using the legacy pass manager), which has its own way of defining -+ manager for the optimization pipeline (the codegen pipeline -+ still uses the legacy pass manager), which has its own way of defining - passes. For more details, see :doc:`WritingAnLLVMNewPMPass` and -- :doc:`NewPassManager`. To use the legacy pass manager with ``opt``, pass -- the ``-enable-new-pm=0`` flag to all ``opt`` invocations. -+ :doc:`NewPassManager`. - - Quick Start --- Writing hello world - =================================== -diff --git a/llvm/test/BugPoint/unsymbolized.ll b/llvm/test/BugPoint/unsymbolized.ll -index d0658b1b6b3a..b181cffd4370 100644 ---- a/llvm/test/BugPoint/unsymbolized.ll -+++ b/llvm/test/BugPoint/unsymbolized.ll -@@ -3,7 +3,7 @@ - ; RUN: echo "print('args = ' + str(sys.argv))" >> %t.py - ; RUN: echo "exit(1)" >> %t.py - ; RUN: not bugpoint -load %llvmshlibdir/BugpointPasses%pluginext %s -output-prefix %t -bugpoint-crashcalls -opt-command=%python -opt-args %t.py | FileCheck %s --; RUN: not --crash opt -enable-new-pm=0 -load %llvmshlibdir/BugpointPasses%pluginext %s -bugpoint-crashcalls -disable-symbolication 2>&1 | FileCheck --check-prefix=CRASH %s -+; RUN: not --crash opt -bugpoint-enable-legacy-pm -load %llvmshlibdir/BugpointPasses%pluginext %s -bugpoint-crashcalls -disable-symbolication 2>&1 | FileCheck --check-prefix=CRASH %s - ; RUN: not bugpoint -load %llvmshlibdir/BugpointPasses%pluginext %s -output-prefix %t -bugpoint-crashcalls -opt-command=%t.non.existent.opt.binary -opt-args %t.py 2>&1 | FileCheck %s --check-prefix=BAD-OPT - - ; Test that bugpoint disables symbolication on the opt tool to reduce runtime overhead when opt crashes -diff --git a/llvm/test/Feature/load_extension.ll b/llvm/test/Feature/load_extension.ll -index 7c97262fdaa8..dd47f2abc541 100644 ---- a/llvm/test/Feature/load_extension.ll -+++ b/llvm/test/Feature/load_extension.ll -@@ -7,10 +7,6 @@ - ; REQUIRES: plugins, examples - ; UNSUPPORTED: target={{.*windows.*}} - ; CHECK: Bye --; --; Specifying a new PM pass plugin with the old PM is an error. --; RUN: ! opt %s %loadnewpmbye -goodbye -wave-goodbye -disable-output -enable-new-pm=0 2>&1 | FileCheck %s --check-prefix=ERROR --; ERROR: load-pass-plugin specified with legacy PM. - - target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" - target triple = "x86_64-unknown-linux-gnu" -diff --git a/llvm/test/Other/opt-On.ll b/llvm/test/Other/opt-On.ll -index 49f2d9d10dee..522f35578f96 100644 ---- a/llvm/test/Other/opt-On.ll -+++ b/llvm/test/Other/opt-On.ll -@@ -19,16 +19,3 @@ define void @f() { - unreachable - } - -- --; Legacy PM deprecation tests (tests should be removed in the future). --; --; RUN: not opt -enable-new-pm=0 -O0 < %s -S 2>&1 | FileCheck %s --check-prefix=LEGACYPM-ERROR --; RUN: not opt -enable-new-pm=0 -O1 < %s -S 2>&1 | FileCheck %s --check-prefix=LEGACYPM-ERROR --; RUN: not opt -enable-new-pm=0 -O2 < %s -S 2>&1 | FileCheck %s --check-prefix=LEGACYPM-ERROR --; RUN: not opt -enable-new-pm=0 -O3 < %s -S 2>&1 | FileCheck %s --check-prefix=LEGACYPM-ERROR --; RUN: not opt -enable-new-pm=0 -Os < %s -S 2>&1 | FileCheck %s --check-prefix=LEGACYPM-ERROR --; RUN: not opt -enable-new-pm=0 -Oz < %s -S 2>&1 | FileCheck %s --check-prefix=LEGACYPM-ERROR --; RUN: not opt -O1 -codegenprepare < %s -S 2>&1 | FileCheck %s --check-prefix=LEGACYPM-ERROR --; RUN: not opt -codegenprepare -O2 < %s -S 2>&1 | FileCheck %s --check-prefix=LEGACYPM-ERROR -- --; LEGACYPM-ERROR: Cannot use -O# with legacy PM -diff --git a/llvm/test/Other/opt-legacy-syntax-deprecation.ll b/llvm/test/Other/opt-legacy-syntax-deprecation.ll -index a5a33564fd7e..50162b333524 100644 ---- a/llvm/test/Other/opt-legacy-syntax-deprecation.ll -+++ b/llvm/test/Other/opt-legacy-syntax-deprecation.ll -@@ -4,7 +4,6 @@ - ; RUN: opt /dev/null -disable-output -passes=instcombine 2>&1 | FileCheck %s --check-prefix=OK --allow-empty - ; RUN: not opt /dev/null -disable-output -instcombine 2>&1 | FileCheck %s --check-prefix=WARN - ; RUN: not opt /dev/null -disable-output -instcombine -always-inline 2>&1 | FileCheck %s --check-prefix=WARN --; RUN: opt /dev/null -disable-output -instcombine -enable-new-pm=0 2>&1 | FileCheck %s --check-prefix=OK --allow-empty - ; RUN: opt /dev/null -disable-output -codegenprepare -mtriple=x86_64-unknown-linux-gnu 2>&1 | FileCheck %s --check-prefix=OK --allow-empty - - ; OK-NOT: deprecated -diff --git a/llvm/tools/bugpoint/OptimizerDriver.cpp b/llvm/tools/bugpoint/OptimizerDriver.cpp -index 1197528d0dd3..f7239f5dc61b 100644 ---- a/llvm/tools/bugpoint/OptimizerDriver.cpp -+++ b/llvm/tools/bugpoint/OptimizerDriver.cpp -@@ -207,7 +207,7 @@ bool BugDriver::runPasses(Module &Program, - Args.push_back(OptArgs[i]); - // Pin to legacy PM since bugpoint has lots of infra and hacks revolving - // around the legacy PM. -- Args.push_back("-enable-new-pm=0"); -+ Args.push_back("-bugpoint-enable-legacy-pm"); - Args.push_back("-disable-symbolication"); - Args.push_back("-o"); - Args.push_back(OutputFilename); -diff --git a/llvm/tools/opt/opt.cpp b/llvm/tools/opt/opt.cpp -index 1b07bbe09416..6a582fb0d425 100644 ---- a/llvm/tools/opt/opt.cpp -+++ b/llvm/tools/opt/opt.cpp -@@ -68,12 +68,12 @@ static codegen::RegisterCodeGenFlags CFG; - static cl::list<const PassInfo *, bool, PassNameParser> PassList(cl::desc( - "Optimizations available (use '-passes=' for the new pass manager)")); - --static cl::opt<bool> EnableNewPassManager( -- "enable-new-pm", -- 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(true)); -+static cl::opt<bool> EnableLegacyPassManager( -+ "bugpoint-enable-legacy-pm", -+ cl::desc( -+ "Enable the legacy pass manager. This is strictly for bugpoint " -+ "due to it not working with the new PM, please do not use otherwise."), -+ cl::init(false)); - - // 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 -@@ -485,11 +485,8 @@ int main(int argc, char **argv) { - - LLVMContext Context; - -- // If `-passes=` is specified, use NPM. -- // If `-enable-new-pm` is specified and there are no codegen passes, use NPM. -- // e.g. `-enable-new-pm -sroa` will use NPM. -- // but `-enable-new-pm -codegenprepare` will still revert to legacy PM. -- const bool UseNPM = (EnableNewPassManager && !shouldForceLegacyPM()) || -+ // TODO: remove shouldForceLegacyPM(). -+ const bool UseNPM = (!EnableLegacyPassManager && !shouldForceLegacyPM()) || - PassPipeline.getNumOccurrences() > 0; - - if (UseNPM && !PassList.empty()) { --- -2.40.0 - @@ -16,7 +16,7 @@ pkgbase=llvm-minimal-git pkgname=('llvm-minimal-git' 'llvm-libs-minimal-git' 'spirv-llvm-translator-minimal-git') -pkgver=17.0.0_r455043.b1e9baea3a2c +pkgver=17.0.0_r455308.3e2d4e85d347 pkgrel=1 arch=('x86_64') url="https://llvm.org/" @@ -26,53 +26,14 @@ makedepends=('git' 'cmake' 'ninja' 'libffi' 'libedit' 'ncurses' 'libxml2' source=("llvm-project::git+https://github.com/llvm/llvm-project.git" 'local://llvm-config.h' "git+https://github.com/KhronosGroup/SPIRV-LLVM-Translator.git" - '0001-IPSCCP-Remove-legacy-pass.patch' - '0002-OCaml-Remove-all-PassManager-related-functions.patch' - '0003-IPO-Remove-various-legacy-passes.patch' - '0004-llvm-c-Remove-bindings-for-creating-legacy-passes.patch' - '0005-llvm-c-Remove-PassManagerBuilder-APIs.patch' - '0006-llvm-c-Remove-pointee-support-from-LLVMGetElementTyp.patch' - '0007-Passes-Remove-some-legacy-passes.patch' - '0008-PassManagerBuilder-Remove-PassManagerBuilder.patch' - '0009-ConstExpr-Remove-select-constant-expression.patch' - '0010-docs-Mention-removal-of-legacy-optimization-pipeline.patch' - '0011-Fix-LLVM-Sphinx-build.patch' - '0012-Passes-Remove-some-legacy-passes.patch' - '0013-opt-Rename-enable-new-pm-bugpoint-enable-legacy-pm.patch' ) md5sums=('SKIP' '295c343dcd457dc534662f011d7cff1a' - 'SKIP' - '245054bc67dec3eb30329bbdeed171b1' - '4c5ac9bca18c8a92280b1699f2f85a16' - '179d535366bdb73c6b02850210aca69c' - '286194131e1b5df0fe50ecd0f1b58eb2' - '9e7e1648b472f83b054bf8dcbfc74175' - 'a4604d7858e1536af63f52dcbc47fbb8' - 'a09eda7d75c717aeb882fdfa67b028c3' - '6f07ebda99c0c0cab5bb2ff063e05152' - 'b43ad443cb817e1e341d25f0de6ba248' - '161e703a83b93d6266c47b9883e55541' - '8ce50e0f42ed9f4d26fff1233d21c055' - '5ae64f8df9f04ecba27765d2401b58b0' - 'ff35711ebdb2833fc084f077c3cdc40f') + 'SKIP') sha512sums=('SKIP' '75e743dea28b280943b3cc7f8bbb871b57d110a7f2b9da2e6845c1c36bf170dd883fca54e463f5f49e0c3effe07fbd0db0f8cf5a12a2469d3f792af21a73fcdd' - 'SKIP' - '4c1e8a455163ceb1e7d3f09f5e68f731e47f2346a2f62e1fe97b19f54c16781efc0b75d52304fe9d4aa62512fd6f32b7bd6e12b319cbe72e7831f1a056ffbfd0' - '92f971db948e8acd4a55cb46ef28dc394c5df07f57844b63d82fc19436e2dfe7b184599ca17d84ef4fa63f6281628d8cc734d74dcc95bc0eee8a5e7c3778f49a' - 'ab46bd37d540e9c62d99cc9e137079e077f032d0ba6531b0685d2bb91a4d832787dd12e3680c76b58d26ada7e81b3a7d8d138c303a6ffb21b593dc549aecb140' - 'd3f5df839b49e4a853e88efaf2fb31c36efb15a91b4803f7e52414ab0e3121f4bfafc7d39edaad52a29106ca648428577f97f4fd12e7575cd3bbe009a1111901' - '034b8262c2cec48fcdf1eef8f74332fc7016ecbf1627ab755f95f525c653cab0dd4199cd60b85dd09a63dc0b76bc9db9f85043c91801940294e42bc1feb1ea60' - '2f227060ab56e04bf3e74fbb785c2edf9fc55121c936ba17ac62275cacdacfb9cb84bfda0e6637e11e744e26212bbfa861fa320084502afb4b7fd247d832993b' - '6d77c23ad97c057898d97fd08af9714ff18c43026e082ad5e654b736caffb1ba814de0ebb9a7e169de9475d819df3cd0058805e4a0f020c55ce3b2272181802a' - '4e006cb70005a4116e8637d9dabf7d3f1668e5ad21429254b641fa9ee716c2822cc718cc91c58e29451e4ffde96d25abfd31813322b82b91f896656c05be1210' - 'af7ee9560ac9346a9424706c1f5e7536f985c7fae74d6342429a8d865bfee529d694f6b835c5dc76952d45392f077c2d756f55d41a28075d8c999f847c5242a6' - 'ed6ac398f3d7c141d789a700880a23ee0f7f82de87462a44941ede6ef9fea426138ce587077ded0265577c2a31b4de9ef7dfa4446be145bce8c1088092e6902b' - '55036920d244f97d9e03de34558f6c20af57e26652acdb1db9f1ee5022c09984d2db2e2d71178b5440d46145ff8ff33c7fbc657195073f630a17a6e6bce42b82' - '852b52175aab6eb6193e0a6a1f8a6e0031061c73158a292472b20a7ac99f00e04d4c8ac266e99c1c2d7e91d8d071dd4d6ad1737a4a2ecc31085153c44f09f9d7' - '3e37d9449d74477c0fc2a6c3af37e06aba6555cc8cef83c71e74cb34e5a6ae3b6a5bc6c3fbb6b88c9cd0684e2e40ae066e1eb56337f8980a4729780bc7f9bdd3') + 'SKIP') options=('staticlibs' '!lto') @@ -101,29 +62,6 @@ pkgver() { echo "${_pkgver}" } -prepare() { - - patch --directory="llvm-project" --reverse --strip=1 --input="${srcdir}"/0013-opt-Rename-enable-new-pm-bugpoint-enable-legacy-pm.patch - patch --directory="llvm-project" --reverse --strip=1 --input="${srcdir}"/0012-Passes-Remove-some-legacy-passes.patch - patch --directory="llvm-project" --reverse --strip=1 --input="${srcdir}"/0011-Fix-LLVM-Sphinx-build.patch - patch --directory="llvm-project" --reverse --strip=1 --input="${srcdir}"/0010-docs-Mention-removal-of-legacy-optimization-pipeline.patch - patch --directory="llvm-project" --reverse --strip=1 --input="${srcdir}"/0009-ConstExpr-Remove-select-constant-expression.patch - patch --directory="llvm-project" --reverse --strip=1 --input="${srcdir}"/0008-PassManagerBuilder-Remove-PassManagerBuilder.patch - patch --directory="llvm-project" --reverse --strip=1 --input="${srcdir}"/0007-Passes-Remove-some-legacy-passes.patch - patch --directory="llvm-project" --reverse --strip=1 --input="${srcdir}"/0006-llvm-c-Remove-pointee-support-from-LLVMGetElementTyp.patch - patch --directory="llvm-project" --reverse --strip=1 --input="${srcdir}"/0005-llvm-c-Remove-PassManagerBuilder-APIs.patch - patch --directory="llvm-project" --reverse --strip=1 --input="${srcdir}"/0004-llvm-c-Remove-bindings-for-creating-legacy-passes.patch - patch --directory="llvm-project" --reverse --strip=1 --input="${srcdir}"/0003-IPO-Remove-various-legacy-passes.patch - patch --directory="llvm-project" --reverse --strip=1 --input="${srcdir}"/0002-OCaml-Remove-all-PassManager-related-functions.patch - # reverting commit b677d0753c0a771c6203607f5dbb56189193a14c , see https://gitlab.freedesktop.org/mesa/mesa/-/issues/8297 - patch --directory="llvm-project" --reverse --strip=1 --input="${srcdir}"/0001-IPSCCP-Remove-legacy-pass.patch - - - - -# patch --directory="llvm-project" --reverse --strip=1 --input="${srcdir}"/0001-IPSCCP-Remove-legacy-pass.patch -} - build() { export CFLAGS+=" ${CPPFLAGS}" |