From 3db1cf7a1e6731a02b475bdda05ea2d38f3e5ea8 Mon Sep 17 00:00:00 2001 From: Kit Barton Date: Mon, 16 Dec 2019 16:37:30 -0500 Subject: [PATCH] [LoopFusion] Use the LoopInfo::isRotatedForm method (NFC). Loop fusion previously had a method to check whether a loop was in rotated form. This method has been moved into the LoopInfo class. This patch removes the old isRotated method from loop fusion, in favour of the new one in LoopInfo. --- llvm/lib/Transforms/Scalar/LoopFuse.cpp | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/llvm/lib/Transforms/Scalar/LoopFuse.cpp b/llvm/lib/Transforms/Scalar/LoopFuse.cpp index a7f4242..b17b243d8 100644 --- a/llvm/lib/Transforms/Scalar/LoopFuse.cpp +++ b/llvm/lib/Transforms/Scalar/LoopFuse.cpp @@ -167,14 +167,8 @@ struct FusionCandidate { const PostDominatorTree *PDT, OptimizationRemarkEmitter &ORE) : Preheader(L->getLoopPreheader()), Header(L->getHeader()), ExitingBlock(L->getExitingBlock()), ExitBlock(L->getExitBlock()), - Latch(L->getLoopLatch()), L(L), Valid(true), GuardBranch(nullptr), - DT(DT), PDT(PDT), ORE(ORE) { - - // TODO: This is temporary while we fuse both rotated and non-rotated - // loops. Once we switch to only fusing rotated loops, the initialization of - // GuardBranch can be moved into the initialization list above. - if (isRotated()) - GuardBranch = L->getLoopGuardBranch(); + Latch(L->getLoopLatch()), L(L), Valid(true), + GuardBranch(L->getLoopGuardBranch()), DT(DT), PDT(PDT), ORE(ORE) { // Walk over all blocks in the loop and check for conditions that may // prevent fusion. For each block, walk over all instructions and collect @@ -261,12 +255,6 @@ struct FusionCandidate { : GuardBranch->getSuccessor(0); } - bool isRotated() const { - assert(L && "Expecting loop to be valid."); - assert(Latch && "Expecting latch to be valid."); - return L->isLoopExiting(Latch); - } - #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) LLVM_DUMP_METHOD void dump() const { dbgs() << "\tGuardBranch: " @@ -320,7 +308,7 @@ struct FusionCandidate { return reportInvalidCandidate(NotSimplifiedForm); } - if (!isRotated()) { + if (!L->isRotatedForm()) { LLVM_DEBUG(dbgs() << "Loop " << L->getName() << " is not rotated!\n"); return reportInvalidCandidate(NotRotated); } -- 2.7.4