Skip to content

Commit 93b263a

Browse files
[SimplifyCFG] Drop unused LockstepReverseIterator class (NFC)
Unmaintained code has been removed.
1 parent 34172bb commit 93b263a

File tree

1 file changed

+1
-72
lines changed

1 file changed

+1
-72
lines changed

llvm/lib/Transforms/Utils/SimplifyCFG.cpp

Lines changed: 1 addition & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1774,77 +1774,6 @@ static bool isSafeCheapLoadStore(const Instruction *I,
17741774
getLoadStoreAlignment(I) < Value::MaximumAlignment;
17751775
}
17761776

1777-
namespace {
1778-
1779-
// LockstepReverseIterator - Iterates through instructions
1780-
// in a set of blocks in reverse order from the first non-terminator.
1781-
// For example (assume all blocks have size n):
1782-
// LockstepReverseIterator I([B1, B2, B3]);
1783-
// *I-- = [B1[n], B2[n], B3[n]];
1784-
// *I-- = [B1[n-1], B2[n-1], B3[n-1]];
1785-
// *I-- = [B1[n-2], B2[n-2], B3[n-2]];
1786-
// ...
1787-
class LockstepReverseIterator {
1788-
ArrayRef<BasicBlock *> Blocks;
1789-
SmallVector<Instruction *, 4> Insts;
1790-
bool Fail;
1791-
1792-
public:
1793-
LockstepReverseIterator(ArrayRef<BasicBlock *> Blocks) : Blocks(Blocks) {
1794-
reset();
1795-
}
1796-
1797-
void reset() {
1798-
Fail = false;
1799-
Insts.clear();
1800-
for (auto *BB : Blocks) {
1801-
Instruction *Inst = BB->getTerminator();
1802-
for (Inst = Inst->getPrevNode(); Inst && isa<DbgInfoIntrinsic>(Inst);)
1803-
Inst = Inst->getPrevNode();
1804-
if (!Inst) {
1805-
// Block wasn't big enough.
1806-
Fail = true;
1807-
return;
1808-
}
1809-
Insts.push_back(Inst);
1810-
}
1811-
}
1812-
1813-
bool isValid() const { return !Fail; }
1814-
1815-
void operator--() {
1816-
if (Fail)
1817-
return;
1818-
for (auto *&Inst : Insts) {
1819-
for (Inst = Inst->getPrevNode(); Inst && isa<DbgInfoIntrinsic>(Inst);)
1820-
Inst = Inst->getPrevNode();
1821-
// Already at beginning of block.
1822-
if (!Inst) {
1823-
Fail = true;
1824-
return;
1825-
}
1826-
}
1827-
}
1828-
1829-
void operator++() {
1830-
if (Fail)
1831-
return;
1832-
for (auto *&Inst : Insts) {
1833-
for (Inst = Inst->getNextNode(); Inst && isa<DbgInfoIntrinsic>(Inst);)
1834-
Inst = Inst->getNextNode();
1835-
// Already at end of block.
1836-
if (!Inst) {
1837-
Fail = true;
1838-
return;
1839-
}
1840-
}
1841-
}
1842-
1843-
ArrayRef<Instruction *> operator*() const { return Insts; }
1844-
};
1845-
1846-
} // end anonymous namespace
1847-
18481777
/// Hoist any common code in the successor blocks up into the block. This
18491778
/// function guarantees that BB dominates all successors. If AllInstsEqOnly is
18501779
/// given, only perform hoisting in case all successors blocks contain matching
@@ -1896,7 +1825,7 @@ bool SimplifyCFGOpt::hoistCommonCodeFromSuccessors(Instruction *TI,
18961825
if (!AllSame)
18971826
return false;
18981827
if (AllSame) {
1899-
LockstepReverseIterator LRI(Succs);
1828+
LockstepReverseIterator<true> LRI(Succs);
19001829
while (LRI.isValid()) {
19011830
Instruction *I0 = (*LRI)[0];
19021831
if (any_of(*LRI, [I0](Instruction *I) {

0 commit comments

Comments
 (0)