From 93b263a01cf898e609d3896edd0ce95789491bcd Mon Sep 17 00:00:00 2001 From: Antonio Frighetto Date: Sat, 22 Feb 2025 11:24:19 +0100 Subject: [SimplifyCFG] Drop unused `LockstepReverseIterator` class (NFC) Unmaintained code has been removed. --- llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 73 +------------------------------ 1 file changed, 1 insertion(+), 72 deletions(-) (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp') diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 44cefcd..21a267d 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -1774,77 +1774,6 @@ static bool isSafeCheapLoadStore(const Instruction *I, getLoadStoreAlignment(I) < Value::MaximumAlignment; } -namespace { - -// LockstepReverseIterator - Iterates through instructions -// in a set of blocks in reverse order from the first non-terminator. -// For example (assume all blocks have size n): -// LockstepReverseIterator I([B1, B2, B3]); -// *I-- = [B1[n], B2[n], B3[n]]; -// *I-- = [B1[n-1], B2[n-1], B3[n-1]]; -// *I-- = [B1[n-2], B2[n-2], B3[n-2]]; -// ... -class LockstepReverseIterator { - ArrayRef Blocks; - SmallVector Insts; - bool Fail; - -public: - LockstepReverseIterator(ArrayRef Blocks) : Blocks(Blocks) { - reset(); - } - - void reset() { - Fail = false; - Insts.clear(); - for (auto *BB : Blocks) { - Instruction *Inst = BB->getTerminator(); - for (Inst = Inst->getPrevNode(); Inst && isa(Inst);) - Inst = Inst->getPrevNode(); - if (!Inst) { - // Block wasn't big enough. - Fail = true; - return; - } - Insts.push_back(Inst); - } - } - - bool isValid() const { return !Fail; } - - void operator--() { - if (Fail) - return; - for (auto *&Inst : Insts) { - for (Inst = Inst->getPrevNode(); Inst && isa(Inst);) - Inst = Inst->getPrevNode(); - // Already at beginning of block. - if (!Inst) { - Fail = true; - return; - } - } - } - - void operator++() { - if (Fail) - return; - for (auto *&Inst : Insts) { - for (Inst = Inst->getNextNode(); Inst && isa(Inst);) - Inst = Inst->getNextNode(); - // Already at end of block. - if (!Inst) { - Fail = true; - return; - } - } - } - - ArrayRef operator*() const { return Insts; } -}; - -} // end anonymous namespace - /// Hoist any common code in the successor blocks up into the block. This /// function guarantees that BB dominates all successors. If AllInstsEqOnly is /// given, only perform hoisting in case all successors blocks contain matching @@ -1896,7 +1825,7 @@ bool SimplifyCFGOpt::hoistCommonCodeFromSuccessors(Instruction *TI, if (!AllSame) return false; if (AllSame) { - LockstepReverseIterator LRI(Succs); + LockstepReverseIterator LRI(Succs); while (LRI.isValid()) { Instruction *I0 = (*LRI)[0]; if (any_of(*LRI, [I0](Instruction *I) { -- cgit v1.1