[llvm] 8277177 - [Transforms] Delete loop-extract pass

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


Author: Aiden Grossman
Date: 2026-08-05T20:51:00-07:00
New Revision: 8277177456936a77940ecda8e82ad571c66aab1f

URL: https://github.com/llvm/llvm-project/commit/8277177456936a77940ecda8e82ad571c66aab1f
DIFF: https://github.com/llvm/llvm-project/commit/8277177456936a77940ecda8e82ad571c66aab1f.diff

LOG: [Transforms] Delete loop-extract pass

This was only used by bugpoint as far as I can tell, which was deleted
in 9d5574dda60151dcd1eb6f315c20e4d9120596f9. Given it is not used
anywhere, remove it.

I'm also not sure it's super useful for downstreams. When we were doing
a research project during my undergrad that needed loop extraction, we
ended up writing our own utilities to do this for reasons that I cannot
remember exactly.

Reviewers: artagnon, nikic

Pull Request: https://github.com/llvm/llvm-project/pull/214252

Added: 
    

Modified: 
    llvm/docs/Passes.md
    llvm/include/llvm/InitializePasses.h
    llvm/include/llvm/LinkAllPasses.h
    llvm/include/llvm/Transforms/IPO.h
    llvm/lib/Passes/PassBuilder.cpp
    llvm/lib/Passes/PassRegistry.def
    llvm/lib/Transforms/IPO/CMakeLists.txt
    llvm/lib/Transforms/IPO/IPO.cpp
    llvm/test/Other/new-pm-print-pipeline.ll

Removed: 
    llvm/include/llvm/Transforms/IPO/LoopExtractor.h
    llvm/lib/Transforms/IPO/LoopExtractor.cpp
    llvm/test/Transforms/CodeExtractor/2004-03-13-LoopExtractorCrash.ll
    llvm/test/Transforms/CodeExtractor/2004-03-14-DominanceProblem.ll
    llvm/test/Transforms/CodeExtractor/2004-03-14-NoSwitchSupport.ll
    llvm/test/Transforms/CodeExtractor/2004-03-17-MissedLiveIns.ll
    llvm/test/Transforms/CodeExtractor/2004-03-17-UpdatePHIsOutsideRegion.ll
    llvm/test/Transforms/CodeExtractor/2004-03-18-InvokeHandling.ll
    llvm/test/Transforms/CodeExtractor/BlockAddressReference.ll
    llvm/test/Transforms/CodeExtractor/BlockAddressSelfReference.ll
    llvm/test/Transforms/CodeExtractor/LoopExtractor.ll
    llvm/test/Transforms/CodeExtractor/LoopExtractor_alloca.ll
    llvm/test/Transforms/CodeExtractor/LoopExtractor_crash.ll
    llvm/test/Transforms/CodeExtractor/LoopExtractor_infinite.ll
    llvm/test/Transforms/CodeExtractor/LoopExtractor_min_wrapper.ll


################################################################################
diff  --git a/llvm/docs/Passes.md b/llvm/docs/Passes.md
index 353130bb4a062..60366dddbd300 100644
--- a/llvm/docs/Passes.md
+++ b/llvm/docs/Passes.md
@@ -589,14 +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.
-
 ### `loop-fusion`: Loop Fusion
 
 Merges adjacent loops when it can prove the transformation preserves the

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


        


More information about the llvm-commits mailing list