diff options
author | Antonio Frighetto <me@antoniofrighetto.com> | 2025-02-22 11:24:19 +0100 |
---|---|---|
committer | Antonio Frighetto <me@antoniofrighetto.com> | 2025-02-22 11:26:13 +0100 |
commit | 93b263a01cf898e609d3896edd0ce95789491bcd (patch) | |
tree | b9d44d59d447ffb02ffa093bff6f5f1e69ba5583 /llvm/lib/Transforms/Utils/SimplifyCFG.cpp | |
parent | 34172bba115d3d65f7a2df245a4d82024090bc0c (diff) | |
download | llvm-93b263a01cf898e609d3896edd0ce95789491bcd.zip llvm-93b263a01cf898e609d3896edd0ce95789491bcd.tar.gz llvm-93b263a01cf898e609d3896edd0ce95789491bcd.tar.bz2 |
[SimplifyCFG] Drop unused `LockstepReverseIterator` class (NFC)
Unmaintained code has been removed.
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 73 |
1 files changed, 1 insertions, 72 deletions
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<BasicBlock *> Blocks; - SmallVector<Instruction *, 4> Insts; - bool Fail; - -public: - LockstepReverseIterator(ArrayRef<BasicBlock *> Blocks) : Blocks(Blocks) { - reset(); - } - - void reset() { - Fail = false; - Insts.clear(); - for (auto *BB : Blocks) { - Instruction *Inst = BB->getTerminator(); - for (Inst = Inst->getPrevNode(); Inst && isa<DbgInfoIntrinsic>(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<DbgInfoIntrinsic>(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<DbgInfoIntrinsic>(Inst);) - Inst = Inst->getNextNode(); - // Already at end of block. - if (!Inst) { - Fail = true; - return; - } - } - } - - ArrayRef<Instruction *> 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<true> LRI(Succs); while (LRI.isValid()) { Instruction *I0 = (*LRI)[0]; if (any_of(*LRI, [I0](Instruction *I) { |