Skip to content

Commit

Permalink
Revert "Introduce RegionInfoAnalysis, which compute Region Tree in th…
Browse files Browse the repository at this point in the history
…e new PassManager. NFC"

This reverts commit 8228b4d374edeb4cc0c5fddf6e1ab876918ee126.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261889 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
etherzhhb committed Feb 25, 2016
1 parent 1258972 commit f5f73cd
Show file tree
Hide file tree
Showing 22 changed files with 0 additions and 149 deletions.
76 changes: 0 additions & 76 deletions include/llvm/Analysis/RegionInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@

namespace llvm {

// FIXME: Replace this brittle forward declaration with the include of the new
// PassManager.h when doing so doesn't break the PassManagerBuilder.
template <typename IRUnitT> class AnalysisManager;
class PreservedAnalyses;

// Class to be specialized for different users of RegionInfo
// (i.e. BasicBlocks or MachineBasicBlocks). This is only to avoid needing to
// pass around an unreasonable number of template parameters.
Expand Down Expand Up @@ -681,22 +676,6 @@ class RegionInfoBase {
RegionInfoBase(const RegionInfoBase &) = delete;
const RegionInfoBase &operator=(const RegionInfoBase &) = delete;

RegionInfoBase(RegionInfoBase &&Arg)
: DT(std::move(Arg.DT)), PDT(std::move(Arg.PDT)), DF(std::move(Arg.DF)),
TopLevelRegion(std::move(Arg.TopLevelRegion)),
BBtoRegion(std::move(Arg.BBtoRegion)) {
Arg.wipe();
}
RegionInfoBase &operator=(RegionInfoBase &&RHS) {
DT = std::move(RHS.DT);
PDT = std::move(RHS.PDT);
DF = std::move(RHS.DF);
TopLevelRegion = std::move(RHS.TopLevelRegion);
BBtoRegion = std::move(RHS.BBtoRegion);
RHS.wipe();
return *this;
}

DomTreeT *DT;
PostDomTreeT *PDT;
DomFrontierT *DF;
Expand All @@ -708,18 +687,6 @@ class RegionInfoBase {
/// Map every BB to the smallest region, that contains BB.
BBtoRegionMap BBtoRegion;

/// \brief Wipe this region tree's state without releasing any resources.
///
/// This is essentially a post-move helper only. It leaves the object in an
/// assignable and destroyable state, but otherwise invalid.
void wipe() {
DT = nullptr;
PDT = nullptr;
DF = nullptr;
TopLevelRegion = nullptr;
BBtoRegion.clear();
}

// Check whether the entries of BBtoRegion for the BBs of region
// SR are correct. Triggers an assertion if not. Calls itself recursively for
// subregions.
Expand Down Expand Up @@ -869,19 +836,10 @@ class Region : public RegionBase<RegionTraits<Function>> {

class RegionInfo : public RegionInfoBase<RegionTraits<Function>> {
public:
typedef RegionInfoBase<RegionTraits<Function>> Base;

explicit RegionInfo();

~RegionInfo() override;

RegionInfo(RegionInfo &&Arg)
: Base(std::move(static_cast<Base &>(Arg))) {}
RegionInfo &operator=(RegionInfo &&RHS) {
Base::operator=(std::move(static_cast<Base &>(RHS)));
return *this;
}

// updateStatistics - Update statistic about created regions.
void updateStatistics(Region *R) final;

Expand Down Expand Up @@ -926,40 +884,6 @@ class RegionInfoPass : public FunctionPass {
//@}
};

/// \brief Analysis pass that exposes the \c RegionInfo for a function.
class RegionInfoAnalysis {
static char PassID;

public:
typedef RegionInfo Result;

/// \brief Opaque, unique identifier for this analysis pass.
static void *ID() { return (void *)&PassID; }

/// \brief Provide a name for the analysis for debugging and logging.
static StringRef name() { return "RegionInfoAnalysis"; }

RegionInfo run(Function &F, AnalysisManager<Function> *AM);
};

/// \brief Printer pass for the \c RegionInfo.
class RegionInfoPrinterPass {
raw_ostream &OS;

public:
explicit RegionInfoPrinterPass(raw_ostream &OS);
PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);

static StringRef name() { return "RegionInfoPrinterPass"; }
};

/// \brief Verifier pass for the \c RegionInfo.
struct RegionInfoVerifierPass {
PreservedAnalyses run(Function &F, AnalysisManager<Function> *AM);

static StringRef name() { return "RegionInfoVerifierPass"; }
};

template <>
template <>
inline BasicBlock *
Expand Down
34 changes: 0 additions & 34 deletions lib/Analysis/RegionInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/RegionInfoImpl.h"
#include "llvm/Analysis/RegionIterator.h"
#include "llvm/IR/PassManager.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
Expand Down Expand Up @@ -181,36 +180,3 @@ namespace llvm {
}
}

//===----------------------------------------------------------------------===//
// RegionInfoAnalysis implementation
//

char RegionInfoAnalysis::PassID;

RegionInfo RegionInfoAnalysis::run(Function &F, AnalysisManager<Function> *AM) {
RegionInfo RI;
auto *DT = &AM->getResult<DominatorTreeAnalysis>(F);
auto *PDT = &AM->getResult<PostDominatorTreeAnalysis>(F);
auto *DF = &AM->getResult<DominanceFrontierAnalysis>(F);

RI.recalculate(F, DT, PDT, DF);
return RI;
}

RegionInfoPrinterPass::RegionInfoPrinterPass(raw_ostream &OS)
: OS(OS) {}

PreservedAnalyses
RegionInfoPrinterPass::run(Function &F, FunctionAnalysisManager *AM) {
OS << "Region Tree for function: " << F.getName() << "\n";
AM->getResult<RegionInfoAnalysis>(F).print(OS);

return PreservedAnalyses::all();
}

PreservedAnalyses RegionInfoVerifierPass::run(Function &F,
AnalysisManager<Function> *AM) {
AM->getResult<RegionInfoAnalysis>(F).verifyAnalysis();

return PreservedAnalyses::all();
}
1 change: 0 additions & 1 deletion lib/Passes/PassBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "llvm/Analysis/LazyCallGraph.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/PostDominators.h"
#include "llvm/Analysis/RegionInfo.h"
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h"
#include "llvm/Analysis/ScopedNoAliasAA.h"
Expand Down
3 changes: 0 additions & 3 deletions lib/Passes/PassRegistry.def
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ FUNCTION_ANALYSIS("domtree", DominatorTreeAnalysis())
FUNCTION_ANALYSIS("postdomtree", PostDominatorTreeAnalysis())
FUNCTION_ANALYSIS("domfrontier", DominanceFrontierAnalysis())
FUNCTION_ANALYSIS("loops", LoopAnalysis())
FUNCTION_ANALYSIS("regions", RegionInfoAnalysis())
FUNCTION_ANALYSIS("no-op-function", NoOpFunctionAnalysis())
FUNCTION_ANALYSIS("scalar-evolution", ScalarEvolutionAnalysis())
FUNCTION_ANALYSIS("targetlibinfo", TargetLibraryAnalysis())
Expand Down Expand Up @@ -95,13 +94,11 @@ FUNCTION_PASS("print<domtree>", DominatorTreePrinterPass(dbgs()))
FUNCTION_PASS("print<postdomtree>", PostDominatorTreePrinterPass(dbgs()))
FUNCTION_PASS("print<domfrontier>", DominanceFrontierPrinterPass(dbgs()))
FUNCTION_PASS("print<loops>", LoopPrinterPass(dbgs()))
FUNCTION_PASS("print<regions>", RegionInfoPrinterPass(dbgs()))
FUNCTION_PASS("print<scalar-evolution>", ScalarEvolutionPrinterPass(dbgs()))
FUNCTION_PASS("simplify-cfg", SimplifyCFGPass())
FUNCTION_PASS("sroa", SROA())
FUNCTION_PASS("verify", VerifierPass())
FUNCTION_PASS("verify<domtree>", DominatorTreeVerifierPass())
FUNCTION_PASS("verify<regions>", RegionInfoVerifierPass())
#undef FUNCTION_PASS

#ifndef LOOP_ANALYSIS
Expand Down
2 changes: 0 additions & 2 deletions test/Analysis/RegionInfo/20100809_bb_not_in_domtree.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
; RUN: opt -regions < %s
; RUN: opt < %s -passes='print<regions>'

define i32 @main() nounwind {
entry:
br label %for.cond
Expand Down
2 changes: 0 additions & 2 deletions test/Analysis/RegionInfo/block_sort.ll
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
; RUN: opt -regions -print-region-style=bb -analyze < %s 2>&1 | FileCheck -check-prefix=BBIT %s
; RUN: opt -regions -print-region-style=rn -analyze < %s 2>&1 | FileCheck -check-prefix=RNIT %s

; RUN: opt < %s -passes='print<regions>' 2>&1 | FileCheck %s

define void @BZ2_blockSort() nounwind {
start:
br label %while
Expand Down
2 changes: 0 additions & 2 deletions test/Analysis/RegionInfo/cond_loop.ll
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
; RUN: opt -regions -print-region-style=bb -analyze < %s 2>&1 | FileCheck -check-prefix=BBIT %s
; RUN: opt -regions -print-region-style=rn -analyze < %s 2>&1 | FileCheck -check-prefix=RNIT %s

; RUN: opt < %s -passes='print<regions>' 2>&1 | FileCheck %s

define void @normal_condition() nounwind {
5:
br label %"0"
Expand Down
2 changes: 0 additions & 2 deletions test/Analysis/RegionInfo/condition_complicated.ll
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
; RUN: opt -regions -print-region-style=bb -analyze < %s 2>&1 | FileCheck -check-prefix=BBIT %s
; RUN: opt -regions -print-region-style=rn -analyze < %s 2>&1 | FileCheck -check-prefix=RNIT %s

; RUN: opt < %s -passes='print<regions>' 2>&1 | FileCheck %s

define internal fastcc zeroext i8 @handle_compress() nounwind {
end165:
br i1 1, label %false239, label %true181
Expand Down
2 changes: 0 additions & 2 deletions test/Analysis/RegionInfo/condition_complicated_2.ll
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
; RUN: opt -regions -print-region-style=bb -analyze < %s 2>&1 | FileCheck -check-prefix=BBIT %s
; RUN: opt -regions -print-region-style=rn -analyze < %s 2>&1 | FileCheck -check-prefix=RNIT %s

; RUN: opt < %s -passes='print<regions>' 2>&1 | FileCheck %s

define internal fastcc void @compress() nounwind {
end33:
br i1 1, label %end124, label %lor.lhs.false95
Expand Down
2 changes: 0 additions & 2 deletions test/Analysis/RegionInfo/condition_forward_edge.ll
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
; RUN: opt -regions -print-region-style=bb -analyze < %s 2>&1 | FileCheck -check-prefix=BBIT %s
; RUN: opt -regions -print-region-style=rn -analyze < %s 2>&1 | FileCheck -check-prefix=RNIT %s

; RUN: opt < %s -passes='print<regions>' 2>&1 | FileCheck %s

define void @normal_condition() nounwind {
0:
br label %"1"
Expand Down
2 changes: 0 additions & 2 deletions test/Analysis/RegionInfo/condition_same_exit.ll
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
; RUN: opt -regions -print-region-style=bb -analyze < %s 2>&1 | FileCheck -check-prefix=BBIT %s
; RUN: opt -regions -print-region-style=rn -analyze < %s 2>&1 | FileCheck -check-prefix=RNIT %s

; RUN: opt < %s -passes='print<regions>' 2>&1 | FileCheck %s

define void @normal_condition() nounwind {
0:
br i1 1, label %"1", label %"4"
Expand Down
2 changes: 0 additions & 2 deletions test/Analysis/RegionInfo/condition_simple.ll
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
; RUN: opt -regions -print-region-style=bb -analyze < %s 2>&1 | FileCheck -check-prefix=BBIT %s
; RUN: opt -regions -print-region-style=rn -analyze < %s 2>&1 | FileCheck -check-prefix=RNIT %s

; RUN: opt < %s -passes='print<regions>' 2>&1 | FileCheck %s

define void @normal_condition() nounwind {
0:
br label %"1"
Expand Down
2 changes: 0 additions & 2 deletions test/Analysis/RegionInfo/exit_in_condition.ll
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
; RUN: opt -regions -print-region-style=bb -analyze < %s 2>&1 | FileCheck -check-prefix=BBIT %s
; RUN: opt -regions -print-region-style=rn -analyze < %s 2>&1 | FileCheck -check-prefix=RNIT %s

; RUN: opt < %s -passes='print<regions>' 2>&1 | FileCheck %s

define internal fastcc zeroext i8 @handle_compress() nounwind {
entry:
br label %outer
Expand Down
2 changes: 0 additions & 2 deletions test/Analysis/RegionInfo/loop_with_condition.ll
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
; RUN: opt -regions -print-region-style=bb -analyze < %s 2>&1 | FileCheck -check-prefix=BBIT %s
; RUN: opt -regions -print-region-style=rn -analyze < %s 2>&1 | FileCheck -check-prefix=RNIT %s

; RUN: opt < %s -passes='print<regions>' 2>&1 | FileCheck %s

define void @normal_condition() nounwind {
0:
br label %"1"
Expand Down
2 changes: 0 additions & 2 deletions test/Analysis/RegionInfo/loops_1.ll
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
; RUN: opt -regions -print-region-style=bb -analyze < %s 2>&1 | FileCheck -check-prefix=BBIT %s
; RUN: opt -regions -print-region-style=rn -analyze < %s 2>&1 | FileCheck -check-prefix=RNIT %s

; RUN: opt < %s -passes='print<regions>' 2>&1 | FileCheck %s

define internal fastcc zeroext i8 @loops_1() nounwind {
entry:
br i1 1, label %outer , label %a
Expand Down
2 changes: 0 additions & 2 deletions test/Analysis/RegionInfo/loops_2.ll
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
; RUN: opt -regions -print-region-style=bb -analyze < %s 2>&1 | FileCheck -check-prefix=BBIT %s
; RUN: opt -regions -print-region-style=rn -analyze < %s 2>&1 | FileCheck -check-prefix=RNIT %s

; RUN: opt < %s -passes='print<regions>' 2>&1 | FileCheck %s

define void @meread_() nounwind {
entry:
br label %bb23
Expand Down
2 changes: 0 additions & 2 deletions test/Analysis/RegionInfo/mix_1.ll
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
; RUN: opt -regions -print-region-style=bb -analyze < %s 2>&1 | FileCheck -check-prefix=BBIT %s
; RUN: opt -regions -print-region-style=rn -analyze < %s 2>&1 | FileCheck -check-prefix=RNIT %s

; RUN: opt < %s -passes='print<regions>' 2>&1 | FileCheck %s

define void @a_linear_impl_fig_1() nounwind {
0:

Expand Down
2 changes: 0 additions & 2 deletions test/Analysis/RegionInfo/nested_loops.ll
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
; RUN: opt -regions -print-region-style=bb -analyze < %s 2>&1 | FileCheck -check-prefix=BBIT %s
; RUN: opt -regions -print-region-style=rn -analyze < %s 2>&1 | FileCheck -check-prefix=RNIT %s

; RUN: opt < %s -passes='print<regions>' 2>&1 | FileCheck %s

define internal fastcc zeroext i8 @handle_compress() nounwind {
entry:
br label %outer
Expand Down
2 changes: 0 additions & 2 deletions test/Analysis/RegionInfo/next.ll
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
; RUN: opt -regions -print-region-style=bb -analyze < %s 2>&1 | FileCheck -check-prefix=BBIT %s
; RUN: opt -regions -print-region-style=rn -analyze < %s 2>&1 | FileCheck -check-prefix=RNIT %s

; RUN: opt < %s -passes='print<regions>' 2>&1 | FileCheck %s

define void @MAIN__() nounwind {
entry:
br label %__label_002001.outer
Expand Down
2 changes: 0 additions & 2 deletions test/Analysis/RegionInfo/paper.ll
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
; RUN: opt -regions -print-region-style=bb -analyze < %s 2>&1 | FileCheck -check-prefix=BBIT %s
; RUN: opt -regions -print-region-style=rn -analyze < %s 2>&1 | FileCheck -check-prefix=RNIT %s

; RUN: opt < %s -passes='print<regions>' 2>&1 | FileCheck %s

define void @a_linear_impl_fig_1() nounwind {
0:
br label %"1"
Expand Down
2 changes: 0 additions & 2 deletions test/Analysis/RegionInfo/two_loops_same_header.ll
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
; RUN: opt -regions -print-region-style=bb -analyze < %s 2>&1 | FileCheck -check-prefix=BBIT %s
; RUN: opt -regions -print-region-style=rn -analyze < %s 2>&1 | FileCheck -check-prefix=RNIT %s

; RUN: opt < %s -passes='print<regions>' 2>&1 | FileCheck %s

define internal fastcc zeroext i8 @handle_compress() nounwind {
entry:
br label %outer
Expand Down
1 change: 0 additions & 1 deletion test/Analysis/RegionInfo/unreachable_bb.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
; RUN: opt -regions -analyze < %s | FileCheck %s
; RUN: opt < %s -passes='print<regions>' 2>&1 | FileCheck %s

; We should not crash if there are some bbs that are not reachable.
define void @f() {
Expand Down

0 comments on commit f5f73cd

Please sign in to comment.