mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 11:42:57 +01:00
Move isLoopInvariant to the Loop class
llvm-svn: 13051
This commit is contained in:
parent
509116ec78
commit
ab6502f058
@ -176,14 +176,6 @@ namespace {
|
|||||||
return CurAST->getAliasSetForPointer(V, 0).isMod();
|
return CurAST->getAliasSetForPointer(V, 0).isMod();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// isLoopInvariant - Return true if the specified value is loop invariant
|
|
||||||
///
|
|
||||||
inline bool isLoopInvariant(Value *V) {
|
|
||||||
if (Instruction *I = dyn_cast<Instruction>(V))
|
|
||||||
return !CurLoop->contains(I->getParent());
|
|
||||||
return true; // All non-instructions are loop invariant
|
|
||||||
}
|
|
||||||
|
|
||||||
bool canSinkOrHoistInst(Instruction &I);
|
bool canSinkOrHoistInst(Instruction &I);
|
||||||
bool isLoopInvariantInst(Instruction &I);
|
bool isLoopInvariantInst(Instruction &I);
|
||||||
bool isNotUsedInLoop(Instruction &I);
|
bool isNotUsedInLoop(Instruction &I);
|
||||||
@ -421,7 +413,7 @@ bool LICM::isNotUsedInLoop(Instruction &I) {
|
|||||||
bool LICM::isLoopInvariantInst(Instruction &I) {
|
bool LICM::isLoopInvariantInst(Instruction &I) {
|
||||||
// The instruction is loop invariant if all of its operands are loop-invariant
|
// The instruction is loop invariant if all of its operands are loop-invariant
|
||||||
for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i)
|
for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i)
|
||||||
if (!isLoopInvariant(I.getOperand(i)))
|
if (!CurLoop->isLoopInvariant(I.getOperand(i)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// If we got this far, the instruction is loop invariant!
|
// If we got this far, the instruction is loop invariant!
|
||||||
@ -714,7 +706,7 @@ void LICM::findPromotableValuesInLoop(
|
|||||||
// set, if the pointer is loop invariant, if if we are not eliminating any
|
// set, if the pointer is loop invariant, if if we are not eliminating any
|
||||||
// volatile loads or stores.
|
// volatile loads or stores.
|
||||||
if (!AS.isForwardingAliasSet() && AS.isMod() && AS.isMustAlias() &&
|
if (!AS.isForwardingAliasSet() && AS.isMod() && AS.isMustAlias() &&
|
||||||
!AS.isVolatile() && isLoopInvariant(AS.begin()->first)) {
|
!AS.isVolatile() && CurLoop->isLoopInvariant(AS.begin()->first)) {
|
||||||
assert(AS.begin() != AS.end() &&
|
assert(AS.begin() != AS.end() &&
|
||||||
"Must alias set should have at least one pointer element in it!");
|
"Must alias set should have at least one pointer element in it!");
|
||||||
Value *V = AS.begin()->first;
|
Value *V = AS.begin()->first;
|
||||||
|
Loading…
Reference in New Issue
Block a user