Skip to content

Commit 3db1cf7

Browse files
committed
[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.
1 parent 3d29c41 commit 3db1cf7

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

Diff for: llvm/lib/Transforms/Scalar/LoopFuse.cpp

+3-15
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,8 @@ struct FusionCandidate {
167167
const PostDominatorTree *PDT, OptimizationRemarkEmitter &ORE)
168168
: Preheader(L->getLoopPreheader()), Header(L->getHeader()),
169169
ExitingBlock(L->getExitingBlock()), ExitBlock(L->getExitBlock()),
170-
Latch(L->getLoopLatch()), L(L), Valid(true), GuardBranch(nullptr),
171-
DT(DT), PDT(PDT), ORE(ORE) {
172-
173-
// TODO: This is temporary while we fuse both rotated and non-rotated
174-
// loops. Once we switch to only fusing rotated loops, the initialization of
175-
// GuardBranch can be moved into the initialization list above.
176-
if (isRotated())
177-
GuardBranch = L->getLoopGuardBranch();
170+
Latch(L->getLoopLatch()), L(L), Valid(true),
171+
GuardBranch(L->getLoopGuardBranch()), DT(DT), PDT(PDT), ORE(ORE) {
178172

179173
// Walk over all blocks in the loop and check for conditions that may
180174
// prevent fusion. For each block, walk over all instructions and collect
@@ -261,12 +255,6 @@ struct FusionCandidate {
261255
: GuardBranch->getSuccessor(0);
262256
}
263257

264-
bool isRotated() const {
265-
assert(L && "Expecting loop to be valid.");
266-
assert(Latch && "Expecting latch to be valid.");
267-
return L->isLoopExiting(Latch);
268-
}
269-
270258
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
271259
LLVM_DUMP_METHOD void dump() const {
272260
dbgs() << "\tGuardBranch: "
@@ -320,7 +308,7 @@ struct FusionCandidate {
320308
return reportInvalidCandidate(NotSimplifiedForm);
321309
}
322310

323-
if (!isRotated()) {
311+
if (!L->isRotatedForm()) {
324312
LLVM_DEBUG(dbgs() << "Loop " << L->getName() << " is not rotated!\n");
325313
return reportInvalidCandidate(NotRotated);
326314
}

0 commit comments

Comments
 (0)