1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

Rename LoopInfo::isRotated() to LoopInfo::isRotatedForm().

This patch renames the LoopInfo::isRotated() method to LoopInfo::isRotatedForm()
to make it clear that the method checks whether the loop is in rotated form, not
whether the loop has been rotated by the LoopRotation pass.
This commit is contained in:
Kit Barton 2019-12-12 14:18:39 -05:00
parent 68d81cc406
commit 6565d62ef3
3 changed files with 24 additions and 20 deletions

View File

@ -756,8 +756,12 @@ public:
/// - guarded by a loop guard branch.
bool isGuarded() const { return (getLoopGuardBranch() != nullptr); }
/// Return true if the loop is rotated
bool isRotated() const {
/// Return true if the loop is in rotated form.
///
/// This does not check if the loop was rotated by loop rotation, instead it
/// only checks if the loop is in rotated form (has a valid latch that exists
/// the loop).
bool isRotatedForm() const {
assert(!isInvalid() && "Loop not in a valid state!");
BasicBlock *Latch = getLoopLatch();
return Latch && isLoopExiting(Latch);

View File

@ -370,7 +370,7 @@ BranchInst *Loop::getLoopGuardBranch() const {
"Expecting a loop with valid preheader and latch");
// Loop should be in rotate form.
if (!isRotated())
if (!isRotatedForm())
return nullptr;
// Disallow loops with more than one unique exit block, as we do not verify

View File

@ -285,7 +285,7 @@ TEST(LoopInfoTest, CanonicalLoop) {
EXPECT_EQ(L->getInductionVariable(SE)->getName(), "i");
EXPECT_EQ(L->getLoopGuardBranch(), Guard);
EXPECT_TRUE(L->isGuarded());
EXPECT_TRUE(L->isRotated());
EXPECT_TRUE(L->isRotatedForm());
});
}
@ -344,7 +344,7 @@ TEST(LoopInfoTest, LoopWithInverseGuardSuccs) {
EXPECT_EQ(L->getInductionVariable(SE)->getName(), "i");
EXPECT_EQ(L->getLoopGuardBranch(), Guard);
EXPECT_TRUE(L->isGuarded());
EXPECT_TRUE(L->isRotated());
EXPECT_TRUE(L->isRotatedForm());
});
}
@ -403,7 +403,7 @@ TEST(LoopInfoTest, LoopWithSwappedGuardCmp) {
EXPECT_EQ(L->getInductionVariable(SE)->getName(), "i");
EXPECT_EQ(L->getLoopGuardBranch(), Guard);
EXPECT_TRUE(L->isGuarded());
EXPECT_TRUE(L->isRotated());
EXPECT_TRUE(L->isRotatedForm());
});
}
@ -462,7 +462,7 @@ TEST(LoopInfoTest, LoopWithInverseLatchSuccs) {
EXPECT_EQ(L->getInductionVariable(SE)->getName(), "i");
EXPECT_EQ(L->getLoopGuardBranch(), Guard);
EXPECT_TRUE(L->isGuarded());
EXPECT_TRUE(L->isRotated());
EXPECT_TRUE(L->isRotatedForm());
});
}
@ -521,7 +521,7 @@ TEST(LoopInfoTest, LoopWithLatchCmpNE) {
EXPECT_EQ(L->getInductionVariable(SE)->getName(), "i");
EXPECT_EQ(L->getLoopGuardBranch(), Guard);
EXPECT_TRUE(L->isGuarded());
EXPECT_TRUE(L->isRotated());
EXPECT_TRUE(L->isRotatedForm());
});
}
@ -581,7 +581,7 @@ TEST(LoopInfoTest, LoopWithGuardCmpSLE) {
EXPECT_EQ(L->getInductionVariable(SE)->getName(), "i");
EXPECT_EQ(L->getLoopGuardBranch(), Guard);
EXPECT_TRUE(L->isGuarded());
EXPECT_TRUE(L->isRotated());
EXPECT_TRUE(L->isRotatedForm());
});
}
@ -637,7 +637,7 @@ TEST(LoopInfoTest, LoopNonConstantStep) {
EXPECT_EQ(L->getInductionVariable(SE)->getName(), "i");
EXPECT_EQ(L->getLoopGuardBranch(), Guard);
EXPECT_TRUE(L->isGuarded());
EXPECT_TRUE(L->isRotated());
EXPECT_TRUE(L->isRotatedForm());
});
}
@ -696,7 +696,7 @@ TEST(LoopInfoTest, LoopUnsignedBounds) {
EXPECT_EQ(L->getInductionVariable(SE)->getName(), "i");
EXPECT_EQ(L->getLoopGuardBranch(), Guard);
EXPECT_TRUE(L->isGuarded());
EXPECT_TRUE(L->isRotated());
EXPECT_TRUE(L->isRotatedForm());
});
}
@ -755,7 +755,7 @@ TEST(LoopInfoTest, DecreasingLoop) {
EXPECT_EQ(L->getInductionVariable(SE)->getName(), "i");
EXPECT_EQ(L->getLoopGuardBranch(), Guard);
EXPECT_TRUE(L->isGuarded());
EXPECT_TRUE(L->isRotated());
EXPECT_TRUE(L->isRotatedForm());
});
}
@ -813,7 +813,7 @@ TEST(LoopInfoTest, CannotFindDirection) {
EXPECT_EQ(L->getInductionVariable(SE)->getName(), "i");
EXPECT_EQ(L->getLoopGuardBranch(), Guard);
EXPECT_TRUE(L->isGuarded());
EXPECT_TRUE(L->isRotated());
EXPECT_TRUE(L->isRotatedForm());
});
}
@ -875,7 +875,7 @@ TEST(LoopInfoTest, ZextIndVar) {
EXPECT_EQ(L->getInductionVariable(SE)->getName(), "indvars.iv");
EXPECT_EQ(L->getLoopGuardBranch(), Guard);
EXPECT_TRUE(L->isGuarded());
EXPECT_TRUE(L->isRotated());
EXPECT_TRUE(L->isRotatedForm());
});
}
@ -1048,7 +1048,7 @@ TEST(LoopInfoTest, UnguardedLoop) {
EXPECT_EQ(L->getInductionVariable(SE)->getName(), "i");
EXPECT_EQ(L->getLoopGuardBranch(), nullptr);
EXPECT_FALSE(L->isGuarded());
EXPECT_TRUE(L->isRotated());
EXPECT_TRUE(L->isRotatedForm());
});
}
@ -1106,7 +1106,7 @@ TEST(LoopInfoTest, UnguardedLoopWithControlFlow) {
EXPECT_EQ(L->getInductionVariable(SE)->getName(), "i");
EXPECT_EQ(L->getLoopGuardBranch(), Guard);
EXPECT_TRUE(L->isGuarded());
EXPECT_TRUE(L->isRotated());
EXPECT_TRUE(L->isRotatedForm());
});
}
@ -1177,7 +1177,7 @@ TEST(LoopInfoTest, LoopNest) {
EXPECT_EQ(L->getInductionVariable(SE)->getName(), "j");
EXPECT_EQ(L->getLoopGuardBranch(), OuterGuard);
EXPECT_TRUE(L->isGuarded());
EXPECT_TRUE(L->isRotated());
EXPECT_TRUE(L->isRotatedForm());
// Next two basic blocks are for.outer and for.inner.preheader - skip
// them.
@ -1202,7 +1202,7 @@ TEST(LoopInfoTest, LoopNest) {
EXPECT_EQ(L->getInductionVariable(SE)->getName(), "i");
EXPECT_EQ(L->getLoopGuardBranch(), InnerGuard);
EXPECT_TRUE(L->isGuarded());
EXPECT_TRUE(L->isRotated());
EXPECT_TRUE(L->isRotatedForm());
});
}
@ -1284,7 +1284,7 @@ TEST(LoopInfoTest, AuxiliaryIV) {
L->isAuxiliaryInductionVariable(Instruction_mulopcode, SE));
EXPECT_EQ(L->getLoopGuardBranch(), Guard);
EXPECT_TRUE(L->isGuarded());
EXPECT_TRUE(L->isRotated());
EXPECT_TRUE(L->isRotatedForm());
});
}
@ -1497,6 +1497,6 @@ TEST(LoopInfoTest, LoopNotRotated) {
EXPECT_TRUE(L->isLoopSimplifyForm());
// This loop is not rotated.
EXPECT_FALSE(L->isRotated());
EXPECT_FALSE(L->isRotatedForm());
});
}