[llvm] [Transforms] Remove bugpoint references (PR #214253)

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 5 20:51:53 PDT 2026


https://github.com/boomanaiden154 updated https://github.com/llvm/llvm-project/pull/214253

>From ef7992a5a9cd510c11ae9688e64bccf857bb2599 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <aidengrossman at google.com>
Date: Wed, 5 Aug 2026 15:13:48 +0000
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20change?=
 =?UTF-8?q?s=20to=20main=20this=20commit=20is=20based=20on?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.7

[skip ci]
---
 llvm/docs/HowToSubmitABug.rst                 |  20 +-
 llvm/docs/OptBisect.rst                       |  11 +-
 llvm/docs/Passes.md                           |  14 +-
 llvm/docs/WritingAnLLVMPass.md                |   2 +-
 llvm/include/llvm/InitializePasses.h          |   2 -
 llvm/include/llvm/LinkAllPasses.h             |   2 -
 llvm/include/llvm/Transforms/IPO.h            |  12 -
 .../llvm/Transforms/IPO/LoopExtractor.h       |  35 ---
 llvm/lib/Passes/PassBuilder.cpp               |   5 -
 llvm/lib/Passes/PassRegistry.def              |   8 -
 llvm/lib/Transforms/IPO/CMakeLists.txt        |   1 -
 llvm/lib/Transforms/IPO/IPO.cpp               |   2 -
 llvm/lib/Transforms/IPO/LoopExtractor.cpp     | 289 ------------------
 llvm/test/Other/new-pm-print-pipeline.ll      |   3 -
 .../2004-03-13-LoopExtractorCrash.ll          |  75 -----
 .../2004-03-14-DominanceProblem.ll            |  33 --
 .../2004-03-14-NoSwitchSupport.ll             |  28 --
 .../CodeExtractor/2004-03-17-MissedLiveIns.ll |  47 ---
 .../2004-03-17-UpdatePHIsOutsideRegion.ll     |  23 --
 .../2004-03-18-InvokeHandling.ll              | 198 ------------
 .../CodeExtractor/BlockAddressReference.ll    |  36 ---
 .../BlockAddressSelfReference.ll              |  50 ---
 .../Transforms/CodeExtractor/LoopExtractor.ll |  68 -----
 .../CodeExtractor/LoopExtractor_alloca.ll     |  54 ----
 .../CodeExtractor/LoopExtractor_crash.ll      |  46 ---
 .../CodeExtractor/LoopExtractor_infinite.ll   |  53 ----
 .../LoopExtractor_min_wrapper.ll              |  35 ---
 llvm/utils/bugpoint_gisel_reducer.py          | 152 ---------
 llvm/utils/findmisopt                         | 177 -----------
 .../gn/secondary/llvm/tools/bugpoint/BUILD.gn |  44 ---
 30 files changed, 12 insertions(+), 1513 deletions(-)
 delete mode 100644 llvm/include/llvm/Transforms/IPO/LoopExtractor.h
 delete mode 100644 llvm/lib/Transforms/IPO/LoopExtractor.cpp
 delete mode 100644 llvm/test/Transforms/CodeExtractor/2004-03-13-LoopExtractorCrash.ll
 delete mode 100644 llvm/test/Transforms/CodeExtractor/2004-03-14-DominanceProblem.ll
 delete mode 100644 llvm/test/Transforms/CodeExtractor/2004-03-14-NoSwitchSupport.ll
 delete mode 100644 llvm/test/Transforms/CodeExtractor/2004-03-17-MissedLiveIns.ll
 delete mode 100644 llvm/test/Transforms/CodeExtractor/2004-03-17-UpdatePHIsOutsideRegion.ll
 delete mode 100644 llvm/test/Transforms/CodeExtractor/2004-03-18-InvokeHandling.ll
 delete mode 100644 llvm/test/Transforms/CodeExtractor/BlockAddressReference.ll
 delete mode 100644 llvm/test/Transforms/CodeExtractor/BlockAddressSelfReference.ll
 delete mode 100644 llvm/test/Transforms/CodeExtractor/LoopExtractor.ll
 delete mode 100644 llvm/test/Transforms/CodeExtractor/LoopExtractor_alloca.ll
 delete mode 100644 llvm/test/Transforms/CodeExtractor/LoopExtractor_crash.ll
 delete mode 100644 llvm/test/Transforms/CodeExtractor/LoopExtractor_infinite.ll
 delete mode 100644 llvm/test/Transforms/CodeExtractor/LoopExtractor_min_wrapper.ll
 delete mode 100755 llvm/utils/bugpoint_gisel_reducer.py
 delete mode 100755 llvm/utils/findmisopt
 delete mode 100644 llvm/utils/gn/secondary/llvm/tools/bugpoint/BUILD.gn

diff --git a/llvm/docs/HowToSubmitABug.rst b/llvm/docs/HowToSubmitABug.rst
index b6f5685b30a68..39b5043319775 100644
--- a/llvm/docs/HowToSubmitABug.rst
+++ b/llvm/docs/HowToSubmitABug.rst
@@ -232,18 +232,8 @@ program is clean under various `sanitizers
 "LLVM bugs" that we have chased down ended up being bugs in the program being
 compiled, not LLVM.
 
-Once you determine that the program itself is not buggy, you should choose
-which code generator you wish to compile the program with (e.g., LLC or the JIT)
-and optionally a series of LLVM passes to run.  For example:
-
-.. code-block:: bash
-
-   bugpoint -run-llc [... optzn passes ...] file-to-test.bc --args -- [program arguments]
-
-bugpoint will try to narrow down your list of passes to the one pass that
-causes an error, and simplify the bitcode file as much as it can to assist
-you. It will print a message letting you know how to reproduce the
-resulting error.
-
-The :doc:`OptBisect <OptBisect>` page shows an alternative method for finding
-incorrect optimization passes.
+Once you determine that the program itself is not buggy, you should work on
+reducing the inputs required to reproduce the miscompilation. The
+:doc:`OptBisect <OptBisect>` page shows how to find the optimization pass
+causing the miscompile. You can use :doc:`llvm-reduce <llvm-reduce>` to
+minimize the bitcode necessary to reproduce the miscompilation.
diff --git a/llvm/docs/OptBisect.rst b/llvm/docs/OptBisect.rst
index e8a09e64e1eeb..7eee52ff1c0d6 100644
--- a/llvm/docs/OptBisect.rst
+++ b/llvm/docs/OptBisect.rst
@@ -21,13 +21,10 @@ allocation.
 
 The ``-opt-bisect-limit`` option can be used with any tool, including front ends
 such as clang, that uses the core LLVM library for optimization and code
-generation.  The exact syntax for invoking the option is discussed below.
-
-This feature is not intended to replace other debugging tools such as bugpoint.
-Rather it provides an alternate course of action when reproducing the problem
-requires a complex build infrastructure that would make using bugpoint
-impractical or when reproducing the failure requires a sequence of
-transformations that is difficult to replicate with tools like opt and llc.
+generation.  The exact syntax for invoking the option is discussed below. This
+makes ``-opt-bisect-limit`` easy to use in situations that require complex
+build infrastructure or when a full pass pipeline is needed that is difficult
+to replace in opt or llc.
 
 
 Getting Started
diff --git a/llvm/docs/Passes.md b/llvm/docs/Passes.md
index 72a5c550da614..60366dddbd300 100644
--- a/llvm/docs/Passes.md
+++ b/llvm/docs/Passes.md
@@ -589,15 +589,6 @@ eliminating loops with non-infinite computable trip counts that have no side
 effects or volatile instructions, and do not contribute to the computation of
 the function's return value.
 
-(passes-loop-extract)=
-
-### `loop-extract`: Extract loops into new functions
-
-A pass wrapper around the `ExtractLoop()` scalar transformation to extract
-each top-level loop into its own new function.  If the loop is the *only* loop
-in a given function, it is not touched.  This is a pass most useful for
-debugging via bugpoint.
-
 ### `loop-fusion`: Loop Fusion
 
 Merges adjacent loops when it can prove the transformation preserves the
@@ -896,10 +887,9 @@ algorithm:
 
 This section describes the LLVM Utility Passes.
 
-### `extract-blocks`: Extract Basic Blocks From Module (for bugpoint use)
+### `extract-blocks`: Extract Basic Blocks From Module
 
-This pass is used by bugpoint to extract all blocks from the module into their
-own functions.
+This pass extracts all blocks from the module into their own functions.
 
 ### `instnamer`: Assign names to anonymous instructions
 
diff --git a/llvm/docs/WritingAnLLVMPass.md b/llvm/docs/WritingAnLLVMPass.md
index 1627dfcb8dcd8..c1cf43d0198d2 100644
--- a/llvm/docs/WritingAnLLVMPass.md
+++ b/llvm/docs/WritingAnLLVMPass.md
@@ -346,7 +346,7 @@ the machine-dependent representation of each LLVM function in the program.
 
 Code generator passes are registered and initialized specially by
 `TargetMachine::addPassesToEmitFile` and similar routines, so they cannot
-generally be run from the {program}`opt` or {program}`bugpoint` commands.
+generally be run from the {program}`opt`.
 
 A `MachineFunctionPass` is also a `FunctionPass`, so all the restrictions
 that apply to a `FunctionPass` also apply to it.  `MachineFunctionPass`es
diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h
index d80e02dcb356f..74fe01a46b5b9 100644
--- a/llvm/include/llvm/InitializePasses.h
+++ b/llvm/include/llvm/InitializePasses.h
@@ -174,7 +174,6 @@ LLVM_ABI void initializeLocalStackSlotPassPass(PassRegistry &);
 LLVM_ABI void initializeLocalizerPass(PassRegistry &);
 LLVM_ABI void initializeLogicalSROALegacyPassPass(PassRegistry &);
 LLVM_ABI void initializeLoopDataPrefetchLegacyPassPass(PassRegistry &);
-LLVM_ABI void initializeLoopExtractorLegacyPassPass(PassRegistry &);
 LLVM_ABI void initializeLoopInfoWrapperPassPass(PassRegistry &);
 LLVM_ABI void initializeLoopPassPass(PassRegistry &);
 LLVM_ABI void initializeLoopSimplifyPass(PassRegistry &);
@@ -306,7 +305,6 @@ LLVM_ABI void
 initializeSeparateConstOffsetFromGEPLegacyPassPass(PassRegistry &);
 LLVM_ABI void initializeShadowStackGCLoweringPass(PassRegistry &);
 LLVM_ABI void initializeShrinkWrapLegacyPass(PassRegistry &);
-LLVM_ABI void initializeSingleLoopExtractorPass(PassRegistry &);
 LLVM_ABI void initializeSinkingLegacyPassPass(PassRegistry &);
 LLVM_ABI void initializeSjLjEHPreparePass(PassRegistry &);
 LLVM_ABI void initializeSlotIndexesWrapperPassPass(PassRegistry &);
diff --git a/llvm/include/llvm/LinkAllPasses.h b/llvm/include/llvm/LinkAllPasses.h
index 5182341fa7a89..6b8c1e22521ad 100644
--- a/llvm/include/llvm/LinkAllPasses.h
+++ b/llvm/include/llvm/LinkAllPasses.h
@@ -95,7 +95,6 @@ struct ForcePassLinking {
     (void)llvm::createLCSSAPass();
     (void)llvm::createLICMPass();
     (void)llvm::createLazyValueInfoPass();
-    (void)llvm::createLoopExtractorPass();
     (void)llvm::createLoopSimplifyPass();
     (void)llvm::createLoopStrengthReducePass();
     (void)llvm::createLoopTermFoldPass();
@@ -119,7 +118,6 @@ struct ForcePassLinking {
     (void)llvm::createRegionViewerPass();
     (void)llvm::createSafeStackPass();
     (void)llvm::createSROAPass();
-    (void)llvm::createSingleLoopExtractorPass();
     (void)llvm::createTailCallEliminationPass();
     (void)llvm::createConstantHoistingPass();
     (void)llvm::createCodeGenPrepareLegacyPass();
diff --git a/llvm/include/llvm/Transforms/IPO.h b/llvm/include/llvm/Transforms/IPO.h
index 7523ae66429ac..7c2135084cacc 100644
--- a/llvm/include/llvm/Transforms/IPO.h
+++ b/llvm/include/llvm/Transforms/IPO.h
@@ -33,18 +33,6 @@ LLVM_ABI ModulePass *createDeadArgEliminationPass();
 /// bugpoint.
 LLVM_ABI ModulePass *createDeadArgHackingPass();
 
-//===----------------------------------------------------------------------===//
-//
-/// createLoopExtractorPass - This pass extracts all natural loops from the
-/// program into a function if it can.
-///
-LLVM_ABI Pass *createLoopExtractorPass();
-
-/// createSingleLoopExtractorPass - This pass extracts one natural loop from the
-/// program into a function if it can.  This is used by bugpoint.
-///
-LLVM_ABI Pass *createSingleLoopExtractorPass();
-
 //===----------------------------------------------------------------------===//
 /// createBarrierNoopPass - This pass is purely a module pass barrier in a pass
 /// manager.
diff --git a/llvm/include/llvm/Transforms/IPO/LoopExtractor.h b/llvm/include/llvm/Transforms/IPO/LoopExtractor.h
deleted file mode 100644
index 23328232d376d..0000000000000
--- a/llvm/include/llvm/Transforms/IPO/LoopExtractor.h
+++ /dev/null
@@ -1,35 +0,0 @@
-//===- LoopExtractor.h - Extract each loop into a new function ------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-//
-// A pass wrapper around the ExtractLoop() scalar transformation to extract each
-// top-level loop into its own new function. If the loop is the ONLY loop in a
-// given function, it is not touched. This is a pass most useful for debugging
-// via bugpoint.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_TRANSFORMS_IPO_LOOPEXTRACTOR_H
-#define LLVM_TRANSFORMS_IPO_LOOPEXTRACTOR_H
-
-#include "llvm/IR/PassManager.h"
-
-namespace llvm {
-
-struct LoopExtractorPass : public OptionalPassInfoMixin<LoopExtractorPass> {
-  LoopExtractorPass(unsigned NumLoops = ~0) : NumLoops(NumLoops) {}
-  LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
-  LLVM_ABI void
-  printPipeline(raw_ostream &OS,
-                function_ref<StringRef(StringRef)> MapClassName2PassName);
-
-private:
-  unsigned NumLoops;
-};
-} // namespace llvm
-
-#endif // LLVM_TRANSFORMS_IPO_LOOPEXTRACTOR_H
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp
index 17d096eba7e36..db4b92811f57e 100644
--- a/llvm/lib/Passes/PassBuilder.cpp
+++ b/llvm/lib/Passes/PassBuilder.cpp
@@ -243,7 +243,6 @@
 #include "llvm/Transforms/IPO/InferFunctionAttrs.h"
 #include "llvm/Transforms/IPO/Instrumentor.h"
 #include "llvm/Transforms/IPO/Internalize.h"
-#include "llvm/Transforms/IPO/LoopExtractor.h"
 #include "llvm/Transforms/IPO/LowerTypeTests.h"
 #include "llvm/Transforms/IPO/MemProfContextDisambiguation.h"
 #include "llvm/Transforms/IPO/MergeFunctions.h"
@@ -969,10 +968,6 @@ Expected<bool> parseDropUnnecessaryAssumesPassOptions(StringRef Params) {
                                             "DropUnnecessaryAssumes");
 }
 
-Expected<bool> parseLoopExtractorPassOptions(StringRef Params) {
-  return PassBuilder::parseSinglePassOption(Params, "single", "LoopExtractor");
-}
-
 Expected<bool> parseLowerMatrixIntrinsicsPassOptions(StringRef Params) {
   return PassBuilder::parseSinglePassOption(Params, "minimal",
                                             "LowerMatrixIntrinsics");
diff --git a/llvm/lib/Passes/PassRegistry.def b/llvm/lib/Passes/PassRegistry.def
index 90593c1effa40..5e592945d0de7 100644
--- a/llvm/lib/Passes/PassRegistry.def
+++ b/llvm/lib/Passes/PassRegistry.def
@@ -246,14 +246,6 @@ MODULE_PASS_WITH_PARAMS(
 MODULE_PASS_WITH_PARAMS(
     "ipsccp", "IPSCCPPass", [](IPSCCPOptions Opts) { return IPSCCPPass(Opts); },
     parseIPSCCPOptions, "no-func-spec;func-spec")
-MODULE_PASS_WITH_PARAMS(
-    "loop-extract", "LoopExtractorPass",
-    [](bool Single) {
-      if (Single)
-        return LoopExtractorPass(1);
-      return LoopExtractorPass();
-    },
-    parseLoopExtractorPassOptions, "single")
 MODULE_PASS_WITH_PARAMS(
     "memprof-use", "MemProfUsePass",
     [](std::string Opts) { return MemProfUsePass(Opts); },
diff --git a/llvm/lib/Transforms/IPO/CMakeLists.txt b/llvm/lib/Transforms/IPO/CMakeLists.txt
index 23c610f1c15e6..ca0e140264829 100644
--- a/llvm/lib/Transforms/IPO/CMakeLists.txt
+++ b/llvm/lib/Transforms/IPO/CMakeLists.txt
@@ -31,7 +31,6 @@ add_llvm_component_library(LLVMipo
   InstrumentorConfigFile.cpp
   InstrumentorStubPrinter.cpp
   Internalize.cpp
-  LoopExtractor.cpp
   LowerTypeTests.cpp
   MemProfContextDisambiguation.cpp
   MergeFunctions.cpp
diff --git a/llvm/lib/Transforms/IPO/IPO.cpp b/llvm/lib/Transforms/IPO/IPO.cpp
index 61a6462c53eae..e289e31c43b36 100644
--- a/llvm/lib/Transforms/IPO/IPO.cpp
+++ b/llvm/lib/Transforms/IPO/IPO.cpp
@@ -22,6 +22,4 @@ void llvm::initializeIPO(PassRegistry &Registry) {
   initializeDAEPass(Registry);
   initializeExpandVariadicsPass(Registry);
   initializeGlobalDCELegacyPassPass(Registry);
-  initializeLoopExtractorLegacyPassPass(Registry);
-  initializeSingleLoopExtractorPass(Registry);
 }
diff --git a/llvm/lib/Transforms/IPO/LoopExtractor.cpp b/llvm/lib/Transforms/IPO/LoopExtractor.cpp
deleted file mode 100644
index 8182ef6449d02..0000000000000
--- a/llvm/lib/Transforms/IPO/LoopExtractor.cpp
+++ /dev/null
@@ -1,289 +0,0 @@
-//===- LoopExtractor.cpp - Extract each loop into a new function ----------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-//
-// A pass wrapper around the ExtractLoop() scalar transformation to extract each
-// top-level loop into its own new function. If the loop is the ONLY loop in a
-// given function, it is not touched. This is a pass most useful for debugging
-// via bugpoint.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/Transforms/IPO/LoopExtractor.h"
-#include "llvm/ADT/Statistic.h"
-#include "llvm/Analysis/AssumptionCache.h"
-#include "llvm/Analysis/LoopInfo.h"
-#include "llvm/IR/Dominators.h"
-#include "llvm/IR/Instructions.h"
-#include "llvm/IR/Module.h"
-#include "llvm/IR/PassManager.h"
-#include "llvm/InitializePasses.h"
-#include "llvm/Pass.h"
-#include "llvm/Transforms/IPO.h"
-#include "llvm/Transforms/Utils.h"
-#include "llvm/Transforms/Utils/CodeExtractor.h"
-using namespace llvm;
-
-#define DEBUG_TYPE "loop-extract"
-
-STATISTIC(NumExtracted, "Number of loops extracted");
-
-namespace {
-struct LoopExtractorLegacyPass : public ModulePass {
-  static char ID; // Pass identification, replacement for typeid
-
-  unsigned NumLoops;
-
-  explicit LoopExtractorLegacyPass(unsigned NumLoops = ~0)
-      : ModulePass(ID), NumLoops(NumLoops) {}
-
-  bool runOnModule(Module &M) override;
-
-  void getAnalysisUsage(AnalysisUsage &AU) const override {
-    AU.addRequiredID(BreakCriticalEdgesID);
-    AU.addRequired<DominatorTreeWrapperPass>();
-    AU.addRequired<LoopInfoWrapperPass>();
-    AU.addPreserved<LoopInfoWrapperPass>();
-    AU.addRequiredID(LoopSimplifyID);
-    AU.addUsedIfAvailable<AssumptionCacheTracker>();
-  }
-};
-
-struct LoopExtractor {
-  explicit LoopExtractor(
-      unsigned NumLoops,
-      function_ref<DominatorTree &(Function &)> LookupDomTree,
-      function_ref<LoopInfo &(Function &)> LookupLoopInfo,
-      function_ref<AssumptionCache *(Function &)> LookupAssumptionCache)
-      : NumLoops(NumLoops), LookupDomTree(LookupDomTree),
-        LookupLoopInfo(LookupLoopInfo),
-        LookupAssumptionCache(LookupAssumptionCache) {}
-  bool runOnModule(Module &M);
-
-private:
-  // The number of natural loops to extract from the program into functions.
-  unsigned NumLoops;
-
-  function_ref<DominatorTree &(Function &)> LookupDomTree;
-  function_ref<LoopInfo &(Function &)> LookupLoopInfo;
-  function_ref<AssumptionCache *(Function &)> LookupAssumptionCache;
-
-  bool runOnFunction(Function &F);
-
-  bool extractLoops(Loop::iterator From, Loop::iterator To, LoopInfo &LI,
-                    DominatorTree &DT);
-  bool extractLoop(Loop *L, LoopInfo &LI, DominatorTree &DT);
-};
-} // namespace
-
-char LoopExtractorLegacyPass::ID = 0;
-INITIALIZE_PASS_BEGIN(LoopExtractorLegacyPass, "loop-extract",
-                      "Extract loops into new functions", false, false)
-INITIALIZE_PASS_DEPENDENCY(BreakCriticalEdges)
-INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
-INITIALIZE_PASS_DEPENDENCY(LoopInfoWrapperPass)
-INITIALIZE_PASS_DEPENDENCY(LoopSimplify)
-INITIALIZE_PASS_END(LoopExtractorLegacyPass, "loop-extract",
-                    "Extract loops into new functions", false, false)
-
-namespace {
-  /// SingleLoopExtractor - For bugpoint.
-struct SingleLoopExtractor : public LoopExtractorLegacyPass {
-  static char ID; // Pass identification, replacement for typeid
-  SingleLoopExtractor() : LoopExtractorLegacyPass(1) {}
-};
-} // End anonymous namespace
-
-char SingleLoopExtractor::ID = 0;
-INITIALIZE_PASS(SingleLoopExtractor, "loop-extract-single",
-                "Extract at most one loop into a new function", false, false)
-
-// createLoopExtractorPass - This pass extracts all natural loops from the
-// program into a function if it can.
-//
-Pass *llvm::createLoopExtractorPass() { return new LoopExtractorLegacyPass(); }
-
-bool LoopExtractorLegacyPass::runOnModule(Module &M) {
-  if (skipModule(M))
-    return false;
-
-  bool Changed = false;
-  auto LookupDomTree = [this](Function &F) -> DominatorTree & {
-    return this->getAnalysis<DominatorTreeWrapperPass>(F).getDomTree();
-  };
-  auto LookupLoopInfo = [this, &Changed](Function &F) -> LoopInfo & {
-    return this->getAnalysis<LoopInfoWrapperPass>(F, &Changed).getLoopInfo();
-  };
-  auto LookupACT = [this](Function &F) -> AssumptionCache * {
-    if (auto *ACT = this->getAnalysisIfAvailable<AssumptionCacheTracker>())
-      return ACT->lookupAssumptionCache(F);
-    return nullptr;
-  };
-  return LoopExtractor(NumLoops, LookupDomTree, LookupLoopInfo, LookupACT)
-             .runOnModule(M) ||
-         Changed;
-}
-
-bool LoopExtractor::runOnModule(Module &M) {
-  if (M.empty())
-    return false;
-
-  if (!NumLoops)
-    return false;
-
-  bool Changed = false;
-
-  // The end of the function list may change (new functions will be added at the
-  // end), so we run from the first to the current last.
-  auto I = M.begin(), E = --M.end();
-  while (true) {
-    Function &F = *I;
-
-    Changed |= runOnFunction(F);
-    if (!NumLoops)
-      break;
-
-    // If this is the last function.
-    if (I == E)
-      break;
-
-    ++I;
-  }
-  return Changed;
-}
-
-bool LoopExtractor::runOnFunction(Function &F) {
-  // Do not modify `optnone` functions.
-  if (F.hasOptNone())
-    return false;
-
-  if (F.empty())
-    return false;
-
-  bool Changed = false;
-  LoopInfo &LI = LookupLoopInfo(F);
-
-  // If there are no loops in the function.
-  if (LI.empty())
-    return Changed;
-
-  DominatorTree &DT = LookupDomTree(F);
-
-  // If there is more than one top-level loop in this function, extract all of
-  // the loops.
-  if (std::next(LI.begin()) != LI.end())
-    return Changed | extractLoops(LI.begin(), LI.end(), LI, DT);
-
-  // Otherwise there is exactly one top-level loop.
-  Loop *TLL = *LI.begin();
-
-  // If the loop is in LoopSimplify form, then extract it only if this function
-  // is more than a minimal wrapper around the loop.
-  if (TLL->isLoopSimplifyForm()) {
-    bool ShouldExtractLoop = false;
-
-    // Extract the loop if the entry block doesn't branch to the loop header.
-    auto *EntryTI = dyn_cast<UncondBrInst>(F.getEntryBlock().getTerminator());
-    if (EntryTI && EntryTI->getSuccessor() != TLL->getHeader()) {
-      ShouldExtractLoop = true;
-    } else {
-      // Check to see if any exits from the loop are more than just return
-      // blocks.
-      SmallVector<BasicBlock *, 8> ExitBlocks;
-      TLL->getExitBlocks(ExitBlocks);
-      for (auto *ExitBlock : ExitBlocks)
-        if (!isa<ReturnInst>(ExitBlock->getTerminator())) {
-          ShouldExtractLoop = true;
-          break;
-        }
-    }
-
-    if (ShouldExtractLoop)
-      return Changed | extractLoop(TLL, LI, DT);
-  }
-
-  // Okay, this function is a minimal container around the specified loop.
-  // If we extract the loop, we will continue to just keep extracting it
-  // infinitely... so don't extract it. However, if the loop contains any
-  // sub-loops, extract them.
-  return Changed | extractLoops(TLL->begin(), TLL->end(), LI, DT);
-}
-
-bool LoopExtractor::extractLoops(Loop::iterator From, Loop::iterator To,
-                                 LoopInfo &LI, DominatorTree &DT) {
-  bool Changed = false;
-  SmallVector<Loop *, 8> Loops;
-
-  // Save the list of loops, as it may change.
-  Loops.assign(From, To);
-  for (Loop *L : Loops) {
-    // If LoopSimplify form is not available, stay out of trouble.
-    if (!L->isLoopSimplifyForm())
-      continue;
-
-    Changed |= extractLoop(L, LI, DT);
-    if (!NumLoops)
-      break;
-  }
-  return Changed;
-}
-
-bool LoopExtractor::extractLoop(Loop *L, LoopInfo &LI, DominatorTree &DT) {
-  assert(NumLoops != 0);
-  Function &Func = *L->getHeader()->getParent();
-  AssumptionCache *AC = LookupAssumptionCache(Func);
-  CodeExtractorAnalysisCache CEAC(Func);
-  CodeExtractor Extractor(L->getBlocks(), &DT, false, nullptr, nullptr, AC);
-  if (Extractor.isEligible()) {
-    // Remove loop while blocks are still in the current function
-    LI.erase(L);
-    [[maybe_unused]] Function *ExtrF = Extractor.extractCodeRegion(CEAC);
-    assert(ExtrF && "CodeExtractor didn't extact eligible loop");
-    --NumLoops;
-    ++NumExtracted;
-    return true;
-  }
-  return false;
-}
-
-// createSingleLoopExtractorPass - This pass extracts one natural loop from the
-// program into a function if it can.  This is used by bugpoint.
-//
-Pass *llvm::createSingleLoopExtractorPass() {
-  return new SingleLoopExtractor();
-}
-
-PreservedAnalyses LoopExtractorPass::run(Module &M, ModuleAnalysisManager &AM) {
-  auto &FAM = AM.getResult<FunctionAnalysisManagerModuleProxy>(M).getManager();
-  auto LookupDomTree = [&FAM](Function &F) -> DominatorTree & {
-    return FAM.getResult<DominatorTreeAnalysis>(F);
-  };
-  auto LookupLoopInfo = [&FAM](Function &F) -> LoopInfo & {
-    return FAM.getResult<LoopAnalysis>(F);
-  };
-  auto LookupAssumptionCache = [&FAM](Function &F) -> AssumptionCache * {
-    return FAM.getCachedResult<AssumptionAnalysis>(F);
-  };
-  if (!LoopExtractor(NumLoops, LookupDomTree, LookupLoopInfo,
-                     LookupAssumptionCache)
-           .runOnModule(M))
-    return PreservedAnalyses::all();
-
-  PreservedAnalyses PA;
-  PA.preserve<LoopAnalysis>();
-  return PA;
-}
-
-void LoopExtractorPass::printPipeline(
-    raw_ostream &OS, function_ref<StringRef(StringRef)> MapClassName2PassName) {
-  static_cast<PassInfoMixin<LoopExtractorPass> *>(this)->printPipeline(
-      OS, MapClassName2PassName);
-  OS << '<';
-  if (NumLoops == 1)
-    OS << "single";
-  OS << '>';
-}
diff --git a/llvm/test/Other/new-pm-print-pipeline.ll b/llvm/test/Other/new-pm-print-pipeline.ll
index 110ff23131667..2a1192b6b66bd 100644
--- a/llvm/test/Other/new-pm-print-pipeline.ll
+++ b/llvm/test/Other/new-pm-print-pipeline.ll
@@ -43,9 +43,6 @@
 ; RUN: opt -disable-output -disable-verify -print-pipeline-passes -passes='module(hwasan<>,hwasan<kernel;recover>)' < %s | FileCheck %s --match-full-lines --check-prefixes=CHECK-14
 ; CHECK-14: hwasan<>,hwasan<kernel;recover>
 
-; RUN: opt -disable-output -disable-verify -print-pipeline-passes -passes='module(loop-extract<>,loop-extract<single>)' < %s | FileCheck %s --match-full-lines --check-prefixes=CHECK-16
-; CHECK-16: loop-extract<>,loop-extract<single>
-
 ; RUN: opt -disable-output -disable-verify -print-pipeline-passes -passes='function(print<stack-lifetime><may>,print<stack-lifetime><must>)' < %s | FileCheck %s --match-full-lines --check-prefixes=CHECK-17
 ; CHECK-17: function(print<stack-lifetime><may>,print<stack-lifetime><must>)
 
diff --git a/llvm/test/Transforms/CodeExtractor/2004-03-13-LoopExtractorCrash.ll b/llvm/test/Transforms/CodeExtractor/2004-03-13-LoopExtractorCrash.ll
deleted file mode 100644
index bcf418e17aae4..0000000000000
--- a/llvm/test/Transforms/CodeExtractor/2004-03-13-LoopExtractorCrash.ll
+++ /dev/null
@@ -1,75 +0,0 @@
-; RUN: opt < %s -passes='function(loop-simplify),loop-extract'  -disable-output
-
-define void @solve() {
-entry:
-	br label %loopentry.0
-
-loopentry.0:		; preds = %endif.0, %entry
-	br i1 false, label %no_exit.0, label %loopexit.0
-
-no_exit.0:		; preds = %loopentry.0
-	br i1 false, label %then.0, label %endif.0
-
-then.0:		; preds = %no_exit.0
-	br i1 false, label %shortcirc_done, label %shortcirc_next
-
-shortcirc_next:		; preds = %then.0
-	br label %shortcirc_done
-
-shortcirc_done:		; preds = %shortcirc_next, %then.0
-	br i1 false, label %then.1, label %endif.1
-
-then.1:		; preds = %shortcirc_done
-	br i1 false, label %cond_true, label %cond_false
-
-cond_true:		; preds = %then.1
-	br label %cond_continue
-
-cond_false:		; preds = %then.1
-	br label %cond_continue
-
-cond_continue:		; preds = %cond_false, %cond_true
-	br label %return
-
-after_ret.0:		; No predecessors!
-	br label %endif.1
-
-endif.1:		; preds = %after_ret.0, %shortcirc_done
-	br label %endif.0
-
-endif.0:		; preds = %endif.1, %no_exit.0
-	br label %loopentry.0
-
-loopexit.0:		; preds = %loopentry.0
-	br i1 false, label %then.2, label %endif.2
-
-then.2:		; preds = %loopexit.0
-	br i1 false, label %then.3, label %endif.3
-
-then.3:		; preds = %then.2
-	br label %return
-
-after_ret.1:		; No predecessors!
-	br label %endif.3
-
-endif.3:		; preds = %after_ret.1, %then.2
-	br label %endif.2
-
-endif.2:		; preds = %endif.3, %loopexit.0
-	br label %loopentry.1
-
-loopentry.1:		; preds = %no_exit.1, %endif.2
-	br i1 false, label %no_exit.1, label %loopexit.1
-
-no_exit.1:		; preds = %loopentry.1
-	br label %loopentry.1
-
-loopexit.1:		; preds = %loopentry.1
-	br label %return
-
-after_ret.2:		; No predecessors!
-	br label %return
-
-return:		; preds = %after_ret.2, %loopexit.1, %then.3, %cond_continue
-	ret void
-}
diff --git a/llvm/test/Transforms/CodeExtractor/2004-03-14-DominanceProblem.ll b/llvm/test/Transforms/CodeExtractor/2004-03-14-DominanceProblem.ll
deleted file mode 100644
index 480b3d7da1409..0000000000000
--- a/llvm/test/Transforms/CodeExtractor/2004-03-14-DominanceProblem.ll
+++ /dev/null
@@ -1,33 +0,0 @@
-; RUN: opt < %s -passes='function(loop-simplify),loop-extract'  -disable-output
-; This testcase is failing the loop extractor because not all exit blocks
-; are dominated by all of the live-outs.
-
-define i32 @ab(i32 %alpha, i32 %beta) {
-entry:
-        br label %loopentry.1.preheader
-
-loopentry.1.preheader:          ; preds = %entry
-        br label %loopentry.1
-
-loopentry.1:            ; preds = %no_exit.1, %loopentry.1.preheader
-        br i1 false, label %no_exit.1, label %loopexit.0.loopexit1
-
-no_exit.1:              ; preds = %loopentry.1
-        %tmp.53 = load i32, ptr null                ; <i32> [#uses=1]
-        br i1 false, label %shortcirc_next.2, label %loopentry.1
-
-shortcirc_next.2:               ; preds = %no_exit.1
-        %tmp.563 = call i32 @wins( i32 0, i32 %tmp.53, i32 3 )          ; <i32> [#uses=0]
-        ret i32 0
-
-loopexit.0.loopexit1:           ; preds = %loopentry.1
-        br label %loopexit.0
-
-loopexit.0:             ; preds = %loopexit.0.loopexit1
-        ret i32 0
-}
-
-declare i32 @wins(i32, i32, i32)
-
-declare i16 @ab_code()
-
diff --git a/llvm/test/Transforms/CodeExtractor/2004-03-14-NoSwitchSupport.ll b/llvm/test/Transforms/CodeExtractor/2004-03-14-NoSwitchSupport.ll
deleted file mode 100644
index 67b929d77376e..0000000000000
--- a/llvm/test/Transforms/CodeExtractor/2004-03-14-NoSwitchSupport.ll
+++ /dev/null
@@ -1,28 +0,0 @@
-; RUN: opt < %s -passes='function(loop-simplify),loop-extract<single>' -disable-output
-
-define void @ab() {
-entry:
-        br label %codeReplTail
-
-then.1:         ; preds = %codeReplTail
-        br label %loopentry.1
-
-loopentry.1:            ; preds = %no_exit.1, %then.1
-        br i1 false, label %no_exit.1, label %loopexit.0.loopexit1
-
-no_exit.1:              ; preds = %loopentry.1
-        br label %loopentry.1
-
-loopexit.0.loopexit:            ; preds = %codeReplTail
-        ret void
-
-loopexit.0.loopexit1:           ; preds = %loopentry.1
-        ret void
-
-codeReplTail:           ; preds = %codeReplTail, %entry
-        switch i16 0, label %codeReplTail [
-                 i16 0, label %loopexit.0.loopexit
-                 i16 1, label %then.1
-        ]
-}
-
diff --git a/llvm/test/Transforms/CodeExtractor/2004-03-17-MissedLiveIns.ll b/llvm/test/Transforms/CodeExtractor/2004-03-17-MissedLiveIns.ll
deleted file mode 100644
index 81c715a631fac..0000000000000
--- a/llvm/test/Transforms/CodeExtractor/2004-03-17-MissedLiveIns.ll
+++ /dev/null
@@ -1,47 +0,0 @@
-; RUN: opt < %s -passes='function(loop-simplify),loop-extract'  -disable-output
-
-define void @sendMTFValues() {
-entry:
-	br i1 false, label %then.1, label %endif.1
-
-then.1:		; preds = %entry
-	br i1 false, label %loopentry.6.preheader, label %else.0
-
-endif.1:		; preds = %entry
-	ret void
-
-else.0:		; preds = %then.1
-	ret void
-
-loopentry.6.preheader:		; preds = %then.1
-	br i1 false, label %endif.7.preheader, label %loopexit.9
-
-endif.7.preheader:		; preds = %loopentry.6.preheader
-	%tmp.183 = add i32 0, -1		; <i32> [#uses=1]
-	br label %endif.7
-
-endif.7:		; preds = %loopexit.15, %endif.7.preheader
-	br i1 false, label %loopentry.10, label %loopentry.12
-
-loopentry.10:		; preds = %endif.7
-	br label %loopentry.12
-
-loopentry.12:		; preds = %loopentry.10, %endif.7
-	%ge.2.1 = phi i32 [ 0, %loopentry.10 ], [ %tmp.183, %endif.7 ]		; <i32> [#uses=0]
-	br i1 false, label %loopexit.14, label %no_exit.11
-
-no_exit.11:		; preds = %loopentry.12
-	ret void
-
-loopexit.14:		; preds = %loopentry.12
-	br i1 false, label %loopexit.15, label %no_exit.14
-
-no_exit.14:		; preds = %loopexit.14
-	ret void
-
-loopexit.15:		; preds = %loopexit.14
-	br i1 false, label %endif.7, label %loopexit.9
-
-loopexit.9:		; preds = %loopexit.15, %loopentry.6.preheader
-	ret void
-}
diff --git a/llvm/test/Transforms/CodeExtractor/2004-03-17-UpdatePHIsOutsideRegion.ll b/llvm/test/Transforms/CodeExtractor/2004-03-17-UpdatePHIsOutsideRegion.ll
deleted file mode 100644
index 5068cfe1a073b..0000000000000
--- a/llvm/test/Transforms/CodeExtractor/2004-03-17-UpdatePHIsOutsideRegion.ll
+++ /dev/null
@@ -1,23 +0,0 @@
-; RUN: opt < %s -passes='function(loop-simplify),loop-extract'  -disable-output
-
-define void @maketree() {
-entry:
-        br i1 false, label %no_exit.1, label %loopexit.0
-
-no_exit.1:              ; preds = %endif, %expandbox.entry, %entry
-        br i1 false, label %endif, label %expandbox.entry
-
-expandbox.entry:                ; preds = %no_exit.1
-        br i1 false, label %loopexit.1, label %no_exit.1
-
-endif:          ; preds = %no_exit.1
-        br i1 false, label %loopexit.1, label %no_exit.1
-
-loopexit.1:             ; preds = %endif, %expandbox.entry
-        %ic.i.0.0.4 = phi i32 [ 0, %expandbox.entry ], [ 0, %endif ]            ; <i32> [#uses=0]
-        ret void
-
-loopexit.0:             ; preds = %entry
-        ret void
-}
-
diff --git a/llvm/test/Transforms/CodeExtractor/2004-03-18-InvokeHandling.ll b/llvm/test/Transforms/CodeExtractor/2004-03-18-InvokeHandling.ll
deleted file mode 100644
index c132bb058acb6..0000000000000
--- a/llvm/test/Transforms/CodeExtractor/2004-03-18-InvokeHandling.ll
+++ /dev/null
@@ -1,198 +0,0 @@
-; RUN: opt < %s -passes='function(loop-simplify),loop-extract'  -disable-output
-
-declare i32 @_IO_getc()
-
-declare void @__errno_location()
-
-define void @yylex() personality ptr @__gcc_personality_v0 {
-entry:
-	switch i32 0, label %label.126 [
-		 i32 0, label %return
-		 i32 61, label %combine
-		 i32 33, label %combine
-		 i32 94, label %combine
-		 i32 37, label %combine
-		 i32 47, label %combine
-		 i32 42, label %combine
-		 i32 62, label %combine
-		 i32 60, label %combine
-		 i32 58, label %combine
-		 i32 124, label %combine
-		 i32 38, label %combine
-		 i32 45, label %combine
-		 i32 43, label %combine
-		 i32 34, label %string_constant
-		 i32 39, label %char_constant
-		 i32 46, label %loopexit.2
-		 i32 57, label %loopexit.2
-		 i32 56, label %loopexit.2
-		 i32 55, label %loopexit.2
-		 i32 54, label %loopexit.2
-		 i32 53, label %loopexit.2
-		 i32 52, label %loopexit.2
-		 i32 51, label %loopexit.2
-		 i32 50, label %loopexit.2
-		 i32 49, label %loopexit.2
-		 i32 48, label %loopexit.2
-		 i32 95, label %letter
-		 i32 122, label %letter
-		 i32 121, label %letter
-		 i32 120, label %letter
-		 i32 119, label %letter
-		 i32 118, label %letter
-		 i32 117, label %letter
-		 i32 116, label %letter
-		 i32 115, label %letter
-		 i32 114, label %letter
-		 i32 113, label %letter
-		 i32 112, label %letter
-		 i32 111, label %letter
-		 i32 110, label %letter
-		 i32 109, label %letter
-		 i32 108, label %letter
-		 i32 107, label %letter
-		 i32 106, label %letter
-		 i32 105, label %letter
-		 i32 104, label %letter
-		 i32 103, label %letter
-		 i32 102, label %letter
-		 i32 101, label %letter
-		 i32 100, label %letter
-		 i32 99, label %letter
-		 i32 98, label %letter
-		 i32 97, label %letter
-		 i32 90, label %letter
-		 i32 89, label %letter
-		 i32 88, label %letter
-		 i32 87, label %letter
-		 i32 86, label %letter
-		 i32 85, label %letter
-		 i32 84, label %letter
-		 i32 83, label %letter
-		 i32 82, label %letter
-		 i32 81, label %letter
-		 i32 80, label %letter
-		 i32 79, label %letter
-		 i32 78, label %letter
-		 i32 77, label %letter
-		 i32 75, label %letter
-		 i32 74, label %letter
-		 i32 73, label %letter
-		 i32 72, label %letter
-		 i32 71, label %letter
-		 i32 70, label %letter
-		 i32 69, label %letter
-		 i32 68, label %letter
-		 i32 67, label %letter
-		 i32 66, label %letter
-		 i32 65, label %letter
-		 i32 64, label %label.13
-		 i32 76, label %label.12
-		 i32 36, label %label.11
-		 i32 -1, label %label.10
-	]
-
-label.10:		; preds = %entry
-	ret void
-
-label.11:		; preds = %entry
-	ret void
-
-label.12:		; preds = %entry
-	ret void
-
-label.13:		; preds = %entry
-	ret void
-
-letter:		; preds = %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry
-	ret void
-
-loopexit.2:		; preds = %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry
-	switch i32 0, label %shortcirc_next.14 [
-		 i32 48, label %then.20
-		 i32 46, label %endif.38
-	]
-
-then.20:		; preds = %loopexit.2
-	switch i32 0, label %else.4 [
-		 i32 120, label %then.21
-		 i32 88, label %then.21
-	]
-
-then.21:		; preds = %then.20, %then.20
-	ret void
-
-else.4:		; preds = %then.20
-	ret void
-
-shortcirc_next.14:		; preds = %loopexit.2
-	ret void
-
-endif.38:		; preds = %loopexit.2
-	br i1 false, label %then.40, label %then.39
-
-then.39:		; preds = %endif.38
-	ret void
-
-then.40:		; preds = %endif.38
-	invoke void @__errno_location( )
-			to label %switchexit.2 unwind label %LongJmpBlkPre
-
-loopentry.6:		; preds = %endif.52
-	switch i32 0, label %switchexit.2 [
-		 i32 73, label %label.82
-		 i32 105, label %label.82
-		 i32 76, label %label.80
-		 i32 108, label %label.80
-		 i32 70, label %label.78
-		 i32 102, label %label.78
-	]
-
-label.78:		; preds = %loopentry.6, %loopentry.6
-	ret void
-
-label.80:		; preds = %loopentry.6, %loopentry.6
-	ret void
-
-label.82:		; preds = %loopentry.6, %loopentry.6
-	%c.0.15.5 = phi i32 [ %tmp.79417, %loopentry.6 ], [ %tmp.79417, %loopentry.6 ]		; <i32> [#uses=0]
-	ret void
-
-switchexit.2:		; preds = %loopentry.6, %then.40
-	br i1 false, label %endif.51, label %loopexit.6
-
-endif.51:		; preds = %switchexit.2
-	br i1 false, label %endif.52, label %then.52
-
-then.52:		; preds = %endif.51
-	ret void
-
-endif.52:		; preds = %endif.51
-	%tmp.79417 = invoke i32 @_IO_getc( )
-			to label %loopentry.6 unwind label %LongJmpBlkPre		; <i32> [#uses=2]
-
-loopexit.6:		; preds = %switchexit.2
-	ret void
-
-char_constant:		; preds = %entry
-	ret void
-
-string_constant:		; preds = %entry
-	ret void
-
-combine:		; preds = %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry, %entry
-	ret void
-
-label.126:		; preds = %entry
-	ret void
-
-return:		; preds = %entry
-	ret void
-
-LongJmpBlkPre:		; preds = %endif.52, %then.40
-        %exn = landingpad { ptr, i32 }
-                 catch ptr null
-	ret void
-}
-
-declare i32 @__gcc_personality_v0(...)
diff --git a/llvm/test/Transforms/CodeExtractor/BlockAddressReference.ll b/llvm/test/Transforms/CodeExtractor/BlockAddressReference.ll
deleted file mode 100644
index fc7875cda7898..0000000000000
--- a/llvm/test/Transforms/CodeExtractor/BlockAddressReference.ll
+++ /dev/null
@@ -1,36 +0,0 @@
-; RUN: opt < %s -passes='function(loop-simplify),loop-extract'  -S | FileCheck %s
-
- at label = common local_unnamed_addr global ptr null
-
-; CHECK: define
-; no outlined function
-; CHECK-NOT: define
-define i32 @sterix(i32 %n) {
-entry:
-  %tobool = icmp ne i32 %n, 0
-  ; this blockaddress references a basic block that goes in the extracted loop
-  %cond = select i1 %tobool, ptr blockaddress(@sterix, %for.cond), ptr blockaddress(@sterix, %exit)
-  store ptr %cond, ptr @label
-  %cmp5 = icmp sgt i32 %n, 0
-  br i1 %cmp5, label %for.body, label %exit
-
-for.cond:
-  %mul = shl nsw i32 %s.06, 1
-  %exitcond = icmp eq i32 %inc, %n
-  br i1 %exitcond, label %exit.loopexit, label %for.body
-
-for.body:
-  %i.07 = phi i32 [ %inc, %for.cond ], [ 0, %entry ]
-  %s.06 = phi i32 [ %mul, %for.cond ], [ 1, %entry ]
-  %inc = add nuw nsw i32 %i.07, 1
-  br label %for.cond
-
-exit.loopexit:
-  %phitmp = icmp ne i32 %s.06, 2
-  %phitmp8 = zext i1 %phitmp to i32
-  br label %exit
-
-exit:
-  %s.1 = phi i32 [ 1, %entry ], [ %phitmp8, %exit.loopexit ]
-  ret i32 %s.1
-}
diff --git a/llvm/test/Transforms/CodeExtractor/BlockAddressSelfReference.ll b/llvm/test/Transforms/CodeExtractor/BlockAddressSelfReference.ll
deleted file mode 100644
index ce71ffa779cb4..0000000000000
--- a/llvm/test/Transforms/CodeExtractor/BlockAddressSelfReference.ll
+++ /dev/null
@@ -1,50 +0,0 @@
-; RUN: opt < %s -passes='function(loop-simplify),loop-extract'  -S | FileCheck %s
-
- at choum.addr = internal unnamed_addr constant [3 x ptr] [ptr blockaddress(@choum, %bb10), ptr blockaddress(@choum, %bb14), ptr blockaddress(@choum, %bb18)]
-
-; CHECK: define
-; no outlined function
-; CHECK-NOT: define
-
-define void @choum(i32 %arg, ptr nocapture %arg1, i32 %arg2) {
-bb:
-  %tmp = icmp sgt i32 %arg, 0
-  br i1 %tmp, label %bb3, label %bb24
-
-bb3:                                              ; preds = %bb
-  %tmp4 = sext i32 %arg2 to i64
-  %tmp5 = getelementptr inbounds [3 x ptr], ptr @choum.addr, i64 0, i64 %tmp4
-  %tmp6 = load ptr, ptr %tmp5
-  %tmp7 = zext i32 %arg to i64
-  br label %bb8
-
-bb8:                                              ; preds = %bb18, %bb3
-  %tmp9 = phi i64 [ 0, %bb3 ], [ %tmp22, %bb18 ]
-  indirectbr ptr %tmp6, [label %bb10, label %bb14, label %bb18]
-
-bb10:                                             ; preds = %bb8
-  %tmp11 = getelementptr inbounds i32, ptr %arg1, i64 %tmp9
-  %tmp12 = load i32, ptr %tmp11
-  %tmp13 = add nsw i32 %tmp12, 1
-  store i32 %tmp13, ptr %tmp11
-  br label %bb14
-
-bb14:                                             ; preds = %bb10, %bb8
-  %tmp15 = getelementptr inbounds i32, ptr %arg1, i64 %tmp9
-  %tmp16 = load i32, ptr %tmp15
-  %tmp17 = shl nsw i32 %tmp16, 1
-  store i32 %tmp17, ptr %tmp15
-  br label %bb18
-
-bb18:                                             ; preds = %bb14, %bb8
-  %tmp19 = getelementptr inbounds i32, ptr %arg1, i64 %tmp9
-  %tmp20 = load i32, ptr %tmp19
-  %tmp21 = add nsw i32 %tmp20, -3
-  store i32 %tmp21, ptr %tmp19
-  %tmp22 = add nuw nsw i64 %tmp9, 1
-  %tmp23 = icmp eq i64 %tmp22, %tmp7
-  br i1 %tmp23, label %bb24, label %bb8
-
-bb24:                                             ; preds = %bb18, %bb
-  ret void
-}
diff --git a/llvm/test/Transforms/CodeExtractor/LoopExtractor.ll b/llvm/test/Transforms/CodeExtractor/LoopExtractor.ll
deleted file mode 100644
index f5a68fad49552..0000000000000
--- a/llvm/test/Transforms/CodeExtractor/LoopExtractor.ll
+++ /dev/null
@@ -1,68 +0,0 @@
-; RUN: opt < %s -passes='function(break-crit-edges,loop-simplify),loop-extract' -S | FileCheck %s
-
-; This function has 2 simple loops and they should be extracted into 2 new functions.
-define void @test3() {
-; CHECK-LABEL: @test3(
-; CHECK-NEXT:  entry:
-; CHECK-NEXT:    br label %codeRepl1
-; CHECK:       codeRepl1:
-; CHECK-NEXT:    call void @test3.loop.0()
-; CHECK-NEXT:    br label %loop.0.loop.1_crit_edge
-; CHECK:       loop.0.loop.1_crit_edge:
-; CHECK-NEXT:    br label %codeRepl
-; CHECK:       codeRepl:
-; CHECK-NEXT:    call void @test3.loop.1()
-; CHECK-NEXT:    br label %exit
-; CHECK:       exit:
-; CHECK-NEXT:    ret void
-
-entry:
-  br label %loop.0
-
-loop.0:                                           ; preds = %loop.0, %entry
-  %index.0 = phi i32 [ 10, %entry ], [ %next.0, %loop.0 ]
-  tail call void @foo()
-  %next.0 = add nsw i32 %index.0, -1
-  %repeat.0 = icmp sgt i32 %index.0, 1
-  br i1 %repeat.0, label %loop.0, label %loop.1
-
-loop.1:                                           ; preds = %loop.0, %loop.1
-  %index.1 = phi i32 [ %next.1, %loop.1 ], [ 10, %loop.0 ]
-  tail call void @foo()
-  %next.1 = add nsw i32 %index.1, -1
-  %repeat.1 = icmp sgt i32 %index.1, 1
-  br i1 %repeat.1, label %loop.1, label %exit
-
-exit:                                             ; preds = %loop.1
-  ret void
-}
-
-declare void @foo()
-
-; CHECK-LABEL: define internal void @test3.loop.1()
-; CHECK-NEXT:  newFuncRoot:
-; CHECK-NEXT:    br label %loop.1
-; CHECK:       loop.1:
-; CHECK-NEXT:    %index.1 = phi i32 [ %next.1, %loop.1.loop.1_crit_edge ], [ 10, %newFuncRoot ]
-; CHECK-NEXT:    tail call void @foo()
-; CHECK-NEXT:    %next.1 = add nsw i32 %index.1, -1
-; CHECK-NEXT:    %repeat.1 = icmp sgt i32 %index.1, 1
-; CHECK-NEXT:    br i1 %repeat.1, label %loop.1.loop.1_crit_edge, label %exit.exitStub
-; CHECK:       loop.1.loop.1_crit_edge:
-; CHECK-NEXT:    br label %loop.1
-; CHECK:       exit.exitStub:
-; CHECK-NEXT:    ret void
-
-; CHECK-LABEL: define internal void @test3.loop.0()
-; CHECK-NEXT:  newFuncRoot:
-; CHECK-NEXT:    br label %loop.0
-; CHECK:       loop.0:
-; CHECK-NEXT:    %index.0 = phi i32 [ 10, %newFuncRoot ], [ %next.0, %loop.0.loop.0_crit_edge ]
-; CHECK-NEXT:    tail call void @foo()
-; CHECK-NEXT:    %next.0 = add nsw i32 %index.0, -1
-; CHECK-NEXT:    %repeat.0 = icmp sgt i32 %index.0, 1
-; CHECK-NEXT:    br i1 %repeat.0, label %loop.0.loop.0_crit_edge, label %loop.0.loop.1_crit_edge.exitStub
-; CHECK:       loop.0.loop.0_crit_edge:
-; CHECK-NEXT:    br label %loop.0
-; CHECK:       loop.0.loop.1_crit_edge.exitStub:
-; CHECK-NEXT:    ret void
diff --git a/llvm/test/Transforms/CodeExtractor/LoopExtractor_alloca.ll b/llvm/test/Transforms/CodeExtractor/LoopExtractor_alloca.ll
deleted file mode 100644
index 09abf1f3cd85b..0000000000000
--- a/llvm/test/Transforms/CodeExtractor/LoopExtractor_alloca.ll
+++ /dev/null
@@ -1,54 +0,0 @@
-; RUN: opt -passes=debugify,loop-simplify,loop-extract -S < %s | FileCheck %s
-
-; This tests 2 cases:
-; 1. loop1 should be extracted into a function, without extracting %v1 alloca.
-; 2. loop2 should be extracted into a function, with the %v2 alloca.
-;
-; This used to produce an invalid IR, where `memcpy` will have a reference to
-; the, now, external value (local to the extracted loop function).
-
-; CHECK-LABEL: define void @test()
-; CHECK-NEXT: entry:
-; CHECK-NEXT:   %v1 = alloca i32
-; CHECK-NEXT:   #dbg_value(ptr %v1
-; CHECK-NEXT:   call void @llvm.memcpy.p0.p0.i64(ptr align 4 undef, ptr %v1, i64 4, i1 true)
-
-; CHECK-LABEL: define internal void @test.loop2()
-; CHECK-NEXT: newFuncRoot:
-; CHECK-NEXT:   %v2 = alloca i32
-
-; CHECK-LABEL: define internal void @test.loop1(ptr %v1)
-; CHECK-NEXT: newFuncRoot:
-; CHECK-NEXT: #dbg_value
-; CHECK-NEXT:   br
-
-define void @test() {
-entry:
-  %v1 = alloca i32, align 4
-  %v2 = alloca i32, align 4
-  call void @llvm.memcpy.p0.p0.i64(ptr align 4 undef, ptr %v1, i64 4, i1 true)
-  br label %loop1
-
-loop1:
-  call void @llvm.lifetime.start.p0(ptr %v1)
-  %r1 = call i32 @foo(ptr %v1)
-  call void @llvm.lifetime.end.p0(ptr %v1)
-  %cmp1 = icmp ne i32 %r1, 0
-  br i1 %cmp1, label %loop1, label %loop2
-
-loop2:
-  call void @llvm.lifetime.start.p0(ptr %v2)
-  %r2 = call i32 @foo(ptr %v2)
-  call void @llvm.lifetime.end.p0(ptr %v2)
-  %cmp2 = icmp ne i32 %r2, 0
-  br i1 %cmp2, label %loop2, label %exit
-
-exit:
-  ret void
-}
-
-declare i32 @foo(ptr)
-
-declare void @llvm.lifetime.start.p0(ptr nocapture)
-declare void @llvm.lifetime.end.p0(ptr nocapture)
-declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg)
diff --git a/llvm/test/Transforms/CodeExtractor/LoopExtractor_crash.ll b/llvm/test/Transforms/CodeExtractor/LoopExtractor_crash.ll
deleted file mode 100644
index 6bd2b9791fffc..0000000000000
--- a/llvm/test/Transforms/CodeExtractor/LoopExtractor_crash.ll
+++ /dev/null
@@ -1,46 +0,0 @@
-; RUN: opt < %s -passes='cgscc(inline,loop-simplify),loop-extract' -S | FileCheck %s
-; RUN: opt < %s -passes='cgscc(argpromotion,loop-simplify),loop-extract' -S | FileCheck %s
-
-; This test used to trigger an assert (PR8929).
-
-define void @test() {
-; CHECK-LABEL: define void @test()
-; CHECK-NEXT:  entry:
-; CHECK-NEXT:    br label %codeRepl
-; CHECK:       codeRepl:
-; CHECK-NEXT:    call void @test.loopentry()
-; CHECK-NEXT:    br label %loopexit
-; CHECK:       loopexit:
-; CHECK-NEXT:    br label %exit
-; CHECK:       exit:
-; CHECK-NEXT:    ret void
-
-entry:
-  br label %loopentry
-
-loopentry:                                        ; preds = %loopbody, %entry
-  br i1 undef, label %loopbody, label %loopexit
-
-loopbody:                                         ; preds = %codeRepl1
-  call void @foo()
-  br label %loopentry
-
-loopexit:                                         ; preds = %codeRepl
-  br label %exit
-
-exit:                                             ; preds = %loopexit
-  ret void
-}
-
-declare void @foo()
-
-; CHECK-LABEL: define internal void @test.loopentry()
-; CHECK-NEXT:  newFuncRoot:
-; CHECK-NEXT:    br label %loopentry
-; CHECK:       loopentry:
-; CHECK-NEXT:    br i1 false, label %loopbody, label %loopexit.exitStub
-; CHECK:       loopbody:
-; CHECK-NEXT:    call void @foo()
-; CHECK-NEXT:    br label %loopentry
-; CHECK:       loopexit.exitStub:
-; CHECK-NEXT:    ret void
diff --git a/llvm/test/Transforms/CodeExtractor/LoopExtractor_infinite.ll b/llvm/test/Transforms/CodeExtractor/LoopExtractor_infinite.ll
deleted file mode 100644
index b70785671bbb6..0000000000000
--- a/llvm/test/Transforms/CodeExtractor/LoopExtractor_infinite.ll
+++ /dev/null
@@ -1,53 +0,0 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --include-generated-funcs
-; RUN: opt < %s -passes=loop-extract -S | FileCheck %s
-
-; This test used to enter an infinite loop, until out of memory (PR3082).
-
-define void @test(i1 %arg) {
-
-entry:
-  br label %loopentry
-
-loopentry:
-  br i1 %arg, label %exit.1, label %loopexit
-
-loopexit:
-  br i1 %arg, label %loopentry, label %exit.0
-
-exit.0:
-  br label %unified
-
-exit.1:
-  br label %unified
-
-unified:
-  ret void
-}
-; CHECK-LABEL: define {{[^@]+}}@test
-; CHECK-SAME: (i1 [[ARG:%.*]]) {
-; CHECK-NEXT:  entry:
-; CHECK-NEXT:    br label [[CODEREPL:%.*]]
-; CHECK:       codeRepl:
-; CHECK-NEXT:    [[TARGETBLOCK:%.*]] = call i1 @test.loopentry(i1 [[ARG]])
-; CHECK-NEXT:    br i1 [[TARGETBLOCK]], label [[EXIT_1:%.*]], label [[EXIT_0:%.*]]
-; CHECK:       exit.0:
-; CHECK-NEXT:    br label [[UNIFIED:%.*]]
-; CHECK:       exit.1:
-; CHECK-NEXT:    br label [[UNIFIED]]
-; CHECK:       unified:
-; CHECK-NEXT:    ret void
-;
-;
-; CHECK-LABEL: define {{[^@]+}}@test.loopentry
-; CHECK-SAME: (i1 [[ARG:%.*]]) {
-; CHECK-NEXT:  newFuncRoot:
-; CHECK-NEXT:    br label [[LOOPENTRY:%.*]]
-; CHECK:       loopentry:
-; CHECK-NEXT:    br i1 [[ARG]], label [[EXIT_1_EXITSTUB:%.*]], label [[LOOPEXIT:%.*]]
-; CHECK:       loopexit:
-; CHECK-NEXT:    br i1 [[ARG]], label [[LOOPENTRY]], label [[EXIT_0_EXITSTUB:%.*]]
-; CHECK:       exit.1.exitStub:
-; CHECK-NEXT:    ret i1 true
-; CHECK:       exit.0.exitStub:
-; CHECK-NEXT:    ret i1 false
-;
diff --git a/llvm/test/Transforms/CodeExtractor/LoopExtractor_min_wrapper.ll b/llvm/test/Transforms/CodeExtractor/LoopExtractor_min_wrapper.ll
deleted file mode 100644
index 3f1bdaebda697..0000000000000
--- a/llvm/test/Transforms/CodeExtractor/LoopExtractor_min_wrapper.ll
+++ /dev/null
@@ -1,35 +0,0 @@
-; RUN: opt < %s -passes='function(break-crit-edges,loop-simplify),loop-extract' -S | FileCheck %s
-
-; This function is just a minimal wrapper around a loop and should not be extracted.
-define void @test() {
-; CHECK-LABEL: @test(
-; CHECK-NEXT:  entry:
-; CHECK-NEXT:    br label %loop
-; CHECK:       loop:
-; CHECK-NEXT:    %index = phi i32 [ 0, %entry ], [ %next, %loop.loop_crit_edge ]
-; CHECK-NEXT:    call void @foo()
-; CHECK-NEXT:    %next = add nsw i32 %index, -1
-; CHECK-NEXT:    %repeat = icmp sgt i32 %index, 1
-; CHECK-NEXT:    br i1 %repeat, label %loop.loop_crit_edge, label %exit
-; CHECK:       loop.loop_crit_edge:
-; CHECK-NEXT:    br label %loop
-; CHECK:       exit:
-; CHECK-NEXT:    ret void
-
-entry:
-  br label %loop
-
-loop:                                             ; preds = %loop, %entry
-  %index = phi i32 [ 0, %entry ], [ %next, %loop ]
-  call void @foo()
-  %next = add nsw i32 %index, -1
-  %repeat = icmp sgt i32 %index, 1
-  br i1 %repeat, label %loop, label %exit
-
-exit:                                             ; preds = %loop
-  ret void
-}
-
-declare void @foo()
-
-; CHECK-NOT: define
diff --git a/llvm/utils/bugpoint_gisel_reducer.py b/llvm/utils/bugpoint_gisel_reducer.py
deleted file mode 100755
index 116ec792e921d..0000000000000
--- a/llvm/utils/bugpoint_gisel_reducer.py
+++ /dev/null
@@ -1,152 +0,0 @@
-#!/usr/bin/env python
-
-"""Reduces GlobalISel failures.
-
-This script is a utility to reduce tests that GlobalISel
-fails to compile.
-
-It runs llc to get the error message using a regex and creates
-a custom command to check that specific error. Then, it runs bugpoint
-with the custom command.
-
-"""
-from __future__ import print_function
-import argparse
-import re
-import subprocess
-import sys
-import tempfile
-import os
-
-
-def log(msg):
-    print(msg)
-
-
-def hr():
-    log("-" * 50)
-
-
-def log_err(msg):
-    print("ERROR: {}".format(msg), file=sys.stderr)
-
-
-def check_path(path):
-    if not os.path.exists(path):
-        log_err("{} does not exist.".format(path))
-        raise
-    return path
-
-
-def check_bin(build_dir, bin_name):
-    file_name = "{}/bin/{}".format(build_dir, bin_name)
-    return check_path(file_name)
-
-
-def run_llc(llc, irfile):
-    pr = subprocess.Popen(
-        [llc, "-o", "-", "-global-isel", "-pass-remarks-missed=gisel", irfile],
-        stdout=subprocess.PIPE,
-        stderr=subprocess.PIPE,
-    )
-    out, err = pr.communicate()
-    res = pr.wait()
-    if res == 0:
-        return 0
-    re_err = re.compile(
-        r"LLVM ERROR: ([a-z\s]+):.*(G_INTRINSIC[_A-Z]* <intrinsic:@[a-zA-Z0-9\.]+>|G_[A-Z_]+)"
-    )
-    match = re_err.match(err)
-    if not match:
-        return 0
-    else:
-        return [match.group(1), match.group(2)]
-
-
-def run_bugpoint(bugpoint_bin, llc_bin, opt_bin, tmp, ir_file):
-    compileCmd = "-compile-command={} -c {} {}".format(
-        os.path.realpath(__file__), llc_bin, tmp
-    )
-    pr = subprocess.Popen(
-        [
-            bugpoint_bin,
-            "-compile-custom",
-            compileCmd,
-            "-opt-command={}".format(opt_bin),
-            ir_file,
-        ]
-    )
-    res = pr.wait()
-    if res != 0:
-        log_err("Unable to reduce the test.")
-        raise
-
-
-def run_bugpoint_check():
-    path_to_llc = sys.argv[2]
-    path_to_err = sys.argv[3]
-    path_to_ir = sys.argv[4]
-    with open(path_to_err, "r") as f:
-        err = f.read()
-        res = run_llc(path_to_llc, path_to_ir)
-        if res == 0:
-            return 0
-        log("GlobalISed failed, {}: {}".format(res[0], res[1]))
-        if res != err.split(";"):
-            return 0
-        else:
-            return 1
-
-
-def main():
-    # Check if this is called by bugpoint.
-    if len(sys.argv) == 5 and sys.argv[1] == "-c":
-        sys.exit(run_bugpoint_check())
-
-    # Parse arguments.
-    parser = argparse.ArgumentParser(
-        description=__doc__, formatter_class=argparse.RawTextHelpFormatter
-    )
-    parser.add_argument("BuildDir", help="Path to LLVM build directory")
-    parser.add_argument("IRFile", help="Path to the input IR file")
-    args = parser.parse_args()
-
-    # Check if the binaries exist.
-    build_dir = check_path(args.BuildDir)
-    ir_file = check_path(args.IRFile)
-    llc_bin = check_bin(build_dir, "llc")
-    opt_bin = check_bin(build_dir, "opt")
-    bugpoint_bin = check_bin(build_dir, "bugpoint")
-
-    # Run llc to see if GlobalISel fails.
-    log("Running llc...")
-    res = run_llc(llc_bin, ir_file)
-    if res == 0:
-        log_err("Expected failure")
-        raise
-    hr()
-    log("GlobalISel failed, {}: {}.".format(res[0], res[1]))
-    tmp = tempfile.NamedTemporaryFile()
-    log("Writing error to {} for bugpoint.".format(tmp.name))
-    tmp.write(";".join(res))
-    tmp.flush()
-    hr()
-
-    # Run bugpoint.
-    log("Running bugpoint...")
-    run_bugpoint(bugpoint_bin, llc_bin, opt_bin, tmp.name, ir_file)
-    hr()
-    log("Done!")
-    hr()
-    output_file = "bugpoint-reduced-simplified.bc"
-    log("Run llvm-dis to disassemble the output:")
-    log("$ {}/bin/llvm-dis -o - {}".format(build_dir, output_file))
-    log("Run llc to reproduce the problem:")
-    log(
-        "$ {}/bin/llc -o - -global-isel "
-        "-pass-remarks-missed=gisel {}".format(build_dir, output_file)
-    )
-
-
-if __name__ == "__main__":
-    main()
diff --git a/llvm/utils/findmisopt b/llvm/utils/findmisopt
deleted file mode 100755
index 24052209428cf..0000000000000
--- a/llvm/utils/findmisopt
+++ /dev/null
@@ -1,177 +0,0 @@
-#!/bin/bash
-#
-#  findmisopt
-#
-#      This is a quick and dirty hack to potentially find a misoptimization
-#      problem. Mostly its to work around problems in bugpoint that prevent
-#      it from finding a problem unless the set of failing optimizations are
-#      known and given to it on the command line.
-#
-#      Given a bitcode file that produces correct output (or return code), 
-#      this script will run through all the optimizations passes that gccas
-#      uses (in the same order) and will narrow down which optimizations
-#      cause the program either generate different output or return a 
-#      different result code. When the passes have been narrowed down, 
-#      bugpoint is invoked to further refine the problem to its origin. If a
-#      release version of bugpoint is available it will be used, otherwise 
-#      debug.
-#
-#   Usage:
-#      findmisopt bcfile outdir progargs [match]
-#
-#   Where:
-#      bcfile 
-#          is the bitcode file input (the unoptimized working case)
-#      outdir
-#          is a directory into which intermediate results are placed
-#      progargs
-#          is a single argument containing all the arguments the program needs
-#      proginput
-#          is a file name from which stdin should be directed
-#      match
-#          if specified to any value causes the result code of the program to
-#          be used to determine success/fail. If not specified success/fail is
-#          determined by diffing the program's output with the non-optimized
-#          output.
-#       
-if [ "$#" -lt 3 ] ; then
-  echo "usage: findmisopt bcfile outdir progargs [match]"
-  exit 1
-fi
-
-dir="${0%%/utils/findmisopt}"
-if [ -x "$dir/Release/bin/bugpoint" ] ; then
-  bugpoint="$dir/Release/bin/bugpoint"
-elif [ -x "$dir/Debug/bin/bugpoint" ] ; then
-  bugpoint="$dir/Debug/bin/bugpoint"
-else
-  echo "findmisopt: bugpoint not found"
-  exit 1
-fi
-
-bcfile="$1"
-outdir="$2"
-args="$3"
-input="$4"
-if [ ! -f "$input" ] ; then
-  input="/dev/null"
-fi
-match="$5"
-name=`basename $bcfile .bc`
-ll="$outdir/${name}.ll"
-s="$outdir/${name}.s"
-prog="$outdir/${name}"
-out="$outdir/${name}.out"
-optbc="$outdir/${name}.opt.bc"
-optll="$outdir/${name}.opt.ll"
-opts="$outdir/${name}.opt.s"
-optprog="$outdir/${name}.opt"
-optout="$outdir/${name}.opt.out"
-ldflags="-lstdc++ -lm -ldl -lc"
-
-echo "Test Name: $name"
-echo "Unoptimized program: $prog"
-echo "  Optimized program: $optprog"
-
-# Define the list of optimizations to run. This comprises the same set of 
-# optimizations that opt -O3 runs, in the same order.
-opt_switches=`llvm-as < /dev/null -o - | opt -O3 -disable-output -debug-pass=Arguments 2>&1 | sed 's/Pass Arguments: //'`
-all_switches="$opt_switches"
-echo "Passes : $all_switches"
-
-# Create output directory if it doesn't exist
-if [ -f "$outdir" ] ; then
-  echo "$outdir is not a directory"
-  exit 1
-fi
-
-if [ ! -d "$outdir" ] ; then
-  mkdir "$outdir" || exit 1
-fi
-
-# Generate the disassembly
-llvm-dis "$bcfile" -o "$ll" -f || exit 1
-
-# Generate the non-optimized program and its output
-llc "$bcfile" -o "$s" -f || exit 1
-gcc "$s" -o "$prog" $ldflags || exit 1
-"$prog" $args > "$out" 2>&1 <$input
-ex1=$?
-
-# Current set of switches is empty
-function tryit {
-  switches_to_use="$1"
-  opt $switches_to_use "$bcfile" -o "$optbc" -f || exit
-  llvm-dis "$optbc" -o "$optll" -f || exit
-  llc "$optbc" -o "$opts" -f || exit
-  gcc "$opts" -o "$optprog" $ldflags || exit
-  "$optprog" $args > "$optout" 2>&1 <"$input"
-  ex2=$?
-
-  if [ -n "$match" ] ; then
-    if [ "$ex1" -ne "$ex2" ] ; then
-      echo "Return code not the same with these switches:"
-      echo $switches
-      echo "Unoptimized returned: $ex1"
-      echo "Optimized   returned: $ex2"
-      return 0
-    fi
-  else
-    diff "$out" "$optout" > /dev/null
-    if [ $? -ne 0 ] ; then
-      echo "Diff fails with these switches:"
-      echo $switches
-      echo "Differences:"
-      diff "$out" "$optout" | head
-      return 0;
-    fi
-  fi
-  return 1
-}
-
-echo "Trying to find optimization that breaks program:"
-for sw in $all_switches ; do
-  echo -n " $sw"
-  switches="$switches $sw"
-  if tryit "$switches" ; then
-    break;
-  fi
-done
-
-# Terminate the previous output with a newline
-echo ""
-
-# Determine if we're done because none of the optimizations broke the program
-if [ "$switches" == " $all_switches" ] ; then
-  echo "The program did not miscompile"
-  exit 0
-fi
-
-final=""
-while [ ! -z "$switches" ] ; do
-  trimmed=`echo "$switches" | sed -e 's/^ *\(-[^ ]*\).*/\1/'`
-  switches=`echo "$switches" | sed -e 's/^ *-[^ ]* *//'`
-  echo "Trimmed $trimmed from left"
-  tryit "$final $switches"
-  if [ "$?" -eq "0" ] ; then
-    echo "Still Failing .. continuing ..."
-    continue
-  else
-    echo "Found required early pass: $trimmed"
-    final="$final $trimmed"
-    continue
-  fi
-  echo "Next Loop"
-done
-
-if [ "$final" == " $all_switches" ] ; then
-  echo "findmisopt: All optimizations pass. Perhaps this isn't a misopt?"
-  exit 0
-fi
-echo "Smallest Optimization list=$final"
-
-bpcmd="$bugpoint -run-llc -disable-loop-extraction --output "$out" --input /dev/null $bcfile $final --args $args"
-
-echo "Running: $bpcmd"
-$bpcmd
-echo "findmisopt finished."
diff --git a/llvm/utils/gn/secondary/llvm/tools/bugpoint/BUILD.gn b/llvm/utils/gn/secondary/llvm/tools/bugpoint/BUILD.gn
deleted file mode 100644
index b1225aaa53f9b..0000000000000
--- a/llvm/utils/gn/secondary/llvm/tools/bugpoint/BUILD.gn
+++ /dev/null
@@ -1,44 +0,0 @@
-executable("bugpoint") {
-  deps = [
-    "//llvm/include/llvm/Config:config",
-    "//llvm/include/llvm/Config:llvm-config",
-    "//llvm/lib/Analysis",
-    "//llvm/lib/Bitcode/Writer",
-    "//llvm/lib/CodeGen",
-    "//llvm/lib/Extensions",
-    "//llvm/lib/IR",
-    "//llvm/lib/IRReader",
-    "//llvm/lib/Linker",
-    "//llvm/lib/Plugins",
-    "//llvm/lib/Support",
-    "//llvm/lib/Target",
-    "//llvm/lib/Target:TargetsToBuild",
-    "//llvm/lib/TargetParser",
-    "//llvm/lib/Transforms/AggressiveInstCombine",
-    "//llvm/lib/Transforms/IPO",
-    "//llvm/lib/Transforms/Instrumentation",
-    "//llvm/lib/Transforms/ObjCARC",
-    "//llvm/lib/Transforms/Scalar",
-    "//llvm/lib/Transforms/Utils",
-    "//llvm/lib/Transforms/Vectorize",
-  ]
-  sources = [
-    "BugDriver.cpp",
-    "CrashDebugger.cpp",
-    "ExecutionDriver.cpp",
-    "ExtractFunction.cpp",
-    "FindBugs.cpp",
-    "Miscompilation.cpp",
-    "OptimizerDriver.cpp",
-    "ToolRunner.cpp",
-    "bugpoint.cpp",
-  ]
-
-  # Support plugins.
-  # FIXME: Disable dead stripping once other binaries are dead-stripped.
-  if (host_os != "mac" && host_os != "win") {
-    # Make sure bugpoint plugins can access bugpoint's symbols.
-    # Corresponds to export_executable_symbols() in cmake.
-    ldflags = [ "-rdynamic" ]
-  }
-}



More information about the llvm-commits mailing list