aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/LoopUtils.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2017-06-25 17:58:25 +0000
committerDaniel Jasper <djasper@google.com>2017-06-25 17:58:25 +0000
commit4c6cd4ccb77cc994765dc9677278e48abf08ed69 (patch)
tree68eb8f6f65f6ff089b74b62e78976173f4746615 /llvm/lib/Transforms/Utils/LoopUtils.cpp
parent18e6b57cdf6e5373d09b3ee198834f4e655f1b1c (diff)
downloadllvm-4c6cd4ccb77cc994765dc9677278e48abf08ed69.zip
llvm-4c6cd4ccb77cc994765dc9677278e48abf08ed69.tar.gz
llvm-4c6cd4ccb77cc994765dc9677278e48abf08ed69.tar.bz2
Revert "[LoopSimplify] Factor the logic to form dedicated exits into a utility."
This leads to a segfault. Chandler already has a test case and should be able to recommit with a fix soon. llvm-svn: 306252
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUtils.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LoopUtils.cpp62
1 files changed, 0 insertions, 62 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp
index 88fa981..e545bc0 100644
--- a/llvm/lib/Transforms/Utils/LoopUtils.cpp
+++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp
@@ -29,7 +29,6 @@
#include "llvm/IR/ValueHandle.h"
#include "llvm/Pass.h"
#include "llvm/Support/Debug.h"
-#include "llvm/Transforms/Utils/BasicBlockUtils.h"
using namespace llvm;
using namespace llvm::PatternMatch;
@@ -923,67 +922,6 @@ bool InductionDescriptor::isInductionPHI(PHINode *Phi, const Loop *TheLoop,
return true;
}
-bool llvm::formDedicatedExitBlocks(Loop *L, DominatorTree *DT, LoopInfo *LI,
- bool PreserveLCSSA) {
- bool Changed = false;
-
- // We re-use a vector for the in-loop predecesosrs.
- SmallVector<BasicBlock *, 4> InLoopPredecessors;
-
- auto RewriteExit = [&](BasicBlock *BB) {
- // See if there are any non-loop predecessors of this exit block and
- // keep track of the in-loop predecessors.
- bool IsDedicatedExit = true;
- for (auto *PredBB : predecessors(BB))
- if (L->contains(PredBB)) {
- if (isa<IndirectBrInst>(PredBB->getTerminator()))
- // We cannot rewrite exiting edges from an indirectbr.
- return false;
-
- InLoopPredecessors.push_back(PredBB);
- } else {
- IsDedicatedExit = false;
- }
-
- // Nothing to do if this is already a dedicated exit.
- if (IsDedicatedExit) {
- InLoopPredecessors.clear();
- return false;
- }
-
- assert(!InLoopPredecessors.empty() && "Must have *some* loop predecessor!");
- auto *NewExitBB = SplitBlockPredecessors(
- BB, InLoopPredecessors, ".loopexit", DT, LI, PreserveLCSSA);
-
- if (!NewExitBB)
- DEBUG(dbgs() << "WARNING: Can't create a dedicated exit block for loop: "
- << *L << "\n");
- else
- DEBUG(dbgs() << "LoopSimplify: Creating dedicated exit block "
- << NewExitBB->getName() << "\n");
- InLoopPredecessors.clear();
- return true;
- };
-
- // Walk the exit blocks directly rather than building up a data structure for
- // them, but only visit each one once.
- SmallPtrSet<BasicBlock *, 4> Visited;
- for (auto *BB : L->blocks())
- for (auto *SuccBB : successors(BB)) {
- // We're looking for exit blocks so skip in-loop successors.
- if (L->contains(SuccBB))
- continue;
-
- // Visit each exit block exactly once.
- if (!Visited.insert(SuccBB).second)
- continue;
-
- Changed |= RewriteExit(SuccBB);
- }
-
- return Changed;
-}
-
/// \brief Returns the instructions that use values defined in the loop.
SmallVector<Instruction *, 8> llvm::findDefsUsedOutsideOfLoop(Loop *L) {
SmallVector<Instruction *, 8> UsedOutside;