diff options
author | Reid Kleckner <rnk@google.com> | 2016-03-28 18:07:40 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2016-03-28 18:07:40 +0000 |
commit | ba85781f5846d156ff867340a203856aa1957dd6 (patch) | |
tree | 9f26256393faeed45a564a00c029a40ac47e5ee2 /llvm/lib/Transforms/Utils/SimplifyCFG.cpp | |
parent | 6601a4420b3862d6cffc4180c1a7bcd238576be6 (diff) | |
download | bcm5719-llvm-ba85781f5846d156ff867340a203856aa1957dd6.tar.gz bcm5719-llvm-ba85781f5846d156ff867340a203856aa1957dd6.zip |
Revert "[SimlifyCFG] Prevent passes from destroying canonical loop structure, especially for nested loops"
This reverts commit r264596.
It does not compile.
llvm-svn: 264604
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 197ac510949..75d42617a6a 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -135,7 +135,6 @@ class SimplifyCFGOpt { const DataLayout &DL; unsigned BonusInstThreshold; AssumptionCache *AC; - SmallPtrSetImpl<BasicBlock *> *LoopHeaders; Value *isValueEqualityComparison(TerminatorInst *TI); BasicBlock *GetValueEqualityComparisonCases(TerminatorInst *TI, std::vector<ValueEqualityComparisonCase> &Cases); @@ -158,10 +157,8 @@ class SimplifyCFGOpt { public: SimplifyCFGOpt(const TargetTransformInfo &TTI, const DataLayout &DL, - unsigned BonusInstThreshold, AssumptionCache *AC, - SmallPtrSetImpl<BasicBlock *> *LoopHeaders) - : TTI(TTI), DL(DL), BonusInstThreshold(BonusInstThreshold), AC(AC), - LoopHeaders(LoopHeaders) {} + unsigned BonusInstThreshold, AssumptionCache *AC) + : TTI(TTI), DL(DL), BonusInstThreshold(BonusInstThreshold), AC(AC) {} bool run(BasicBlock *BB); }; } @@ -3365,7 +3362,6 @@ bool SimplifyCFGOpt::SimplifySingleResume(ResumeInst *RI) { // The landingpad is now unreachable. Zap it. BB->eraseFromParent(); - if (LoopHeaders) LoopHeaders->erase(BB); return true; } @@ -3484,7 +3480,6 @@ static bool removeEmptyCleanup(CleanupReturnInst *RI) { // The cleanup pad is now unreachable. Zap it. BB->eraseFromParent(); - if (LoopHeaders) LoopHeaders->erase(BB); return true; } @@ -3565,11 +3560,9 @@ bool SimplifyCFGOpt::SimplifyReturn(ReturnInst *RI, IRBuilder<> &Builder) { } // If we eliminated all predecessors of the block, delete the block now. - if (pred_empty(BB)) { + if (pred_empty(BB)) // We know there are no successors, so just nuke the block. BB->eraseFromParent(); - if (LoopHeaders) LoopHeaders->erase(BB); - } return true; } @@ -3726,7 +3719,6 @@ bool SimplifyCFGOpt::SimplifyUnreachable(UnreachableInst *UI) { BB != &BB->getParent()->getEntryBlock()) { // We know there are no successors, so just nuke the block. BB->eraseFromParent(); - if (LoopHeaders) LoopHeaders->erase(BB); return true; } @@ -5070,14 +5062,8 @@ bool SimplifyCFGOpt::SimplifyUncondBranch(BranchInst *BI, IRBuilder<> &Builder){ return true; // If the Terminator is the only non-phi instruction, simplify the block. - // if LoopHeader is provided, check if the block is a loop header - // (This is for early invocations before loop simplify and vectorization - // to keep canonical loop forms for nested loops. - // These blocks can be eliminated when the pass is invoked later - // in the back-end.) BasicBlock::iterator I = BB->getFirstNonPHIOrDbg()->getIterator(); if (I->isTerminator() && BB != &BB->getParent()->getEntryBlock() && - (!LoopHeaders || (LoopHeaders && !LoopHeaders->count(BB))) && TryToSimplifyUncondBranchFromEmptyBlock(BB)) return true; @@ -5357,8 +5343,7 @@ bool SimplifyCFGOpt::run(BasicBlock *BB) { /// of the CFG. It returns true if a modification was made. /// bool llvm::SimplifyCFG(BasicBlock *BB, const TargetTransformInfo &TTI, - unsigned BonusInstThreshold, AssumptionCache *AC, - SmallPtrSetImpl<BasicBlock *> *LoopHeaders) { + unsigned BonusInstThreshold, AssumptionCache *AC) { return SimplifyCFGOpt(TTI, BB->getModule()->getDataLayout(), - BonusInstThreshold, AC, LoopHeaders).run(BB); + BonusInstThreshold, AC).run(BB); } |