Skip to content

Commit 41390b4

Browse files
committed
Revert r346810 "Preserve loop metadata when splitting exit blocks"
It broke the Windows self-host: http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/1457 llvm-svn: 346823
1 parent 7d76ef9 commit 41390b4

File tree

2 files changed

+0
-80
lines changed

2 files changed

+0
-80
lines changed

llvm/lib/Transforms/Utils/LoopUtils.cpp

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -74,41 +74,9 @@ bool llvm::formDedicatedExitBlocks(Loop *L, DominatorTree *DT, LoopInfo *LI,
7474
if (IsDedicatedExit)
7575
return false;
7676

77-
// With nested loops, the inner loop might exit to the header of an
78-
// enclosing loop, and the in-loop-predecessor is a latch for that
79-
// enclosing loop. If we insert a block between the latch and the header,
80-
// that block becomes the new latch. Any loop metadata from the old latch
81-
// needs to be moved to the new one.
82-
MDNode *OuterLoopMD = nullptr;
83-
84-
// If the exit block is a header of a different loop, get that loop's
85-
// metadata before we split the block.
86-
if (LI->isLoopHeader(BB))
87-
OuterLoopMD = LI->getLoopFor(BB)->getLoopID();
88-
8977
auto *NewExitBB = SplitBlockPredecessors(
9078
BB, InLoopPredecessors, ".loopexit", DT, LI, nullptr, PreserveLCSSA);
9179

92-
// If OuterLoopMD is non-null, we know that the exit block BB is a
93-
// loop header for a different loop, with metadata on its back edges.
94-
// If NewExitBB is a member of that loop, then NewExitBB is a latch,
95-
// and the loop's metadata needs to be copied to NewExitBB.
96-
if (NewExitBB && OuterLoopMD &&
97-
LI->getLoopFor(NewExitBB) == LI->getLoopFor(BB)) {
98-
// The preds of NewExitBB are all former latches of the outer loop.
99-
// Remove their metadata.
100-
for (auto *PredLoopBB : InLoopPredecessors) {
101-
Instruction *TI = PredLoopBB->getTerminator();
102-
// All the latches should have the same metadata (ensured by
103-
// getLoopID()).
104-
assert(TI->getMetadata(LLVMContext::MD_loop) == OuterLoopMD &&
105-
"exit edge to other loop doesn't contain expected metadata");
106-
TI->setMetadata(LLVMContext::MD_loop, nullptr);
107-
}
108-
NewExitBB->getTerminator()->setMetadata(LLVMContext::MD_loop,
109-
OuterLoopMD);
110-
}
111-
11280
if (!NewExitBB)
11381
LLVM_DEBUG(
11482
dbgs() << "WARNING: Can't create a dedicated exit block for loop: "

llvm/test/Transforms/LoopSimplify/preserve-llvm-loop-metadata2.ll

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)