@@ -74,41 +74,9 @@ bool llvm::formDedicatedExitBlocks(Loop *L, DominatorTree *DT, LoopInfo *LI,
74
74
if (IsDedicatedExit)
75
75
return false ;
76
76
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
-
89
77
auto *NewExitBB = SplitBlockPredecessors (
90
78
BB, InLoopPredecessors, " .loopexit" , DT, LI, nullptr , PreserveLCSSA);
91
79
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
-
112
80
if (!NewExitBB)
113
81
LLVM_DEBUG (
114
82
dbgs () << " WARNING: Can't create a dedicated exit block for loop: "
0 commit comments