mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 04:02:41 +01:00
Rename and reorder the arguments to isImpliedCond, for consistency and clarity.
llvm-svn: 110750
This commit is contained in:
parent
57a1489759
commit
7e49302e9a
@ -352,10 +352,11 @@ namespace llvm {
|
|||||||
std::pair<BasicBlock *, BasicBlock *>
|
std::pair<BasicBlock *, BasicBlock *>
|
||||||
getPredecessorWithUniqueSuccessorForBB(BasicBlock *BB);
|
getPredecessorWithUniqueSuccessorForBB(BasicBlock *BB);
|
||||||
|
|
||||||
/// isImpliedCond - Test whether the condition described by Pred, LHS,
|
/// isImpliedCond - Test whether the condition described by Pred, LHS, and
|
||||||
/// and RHS is true whenever the given Cond value evaluates to true.
|
/// RHS is true whenever the given FoundCondValue value evaluates to true.
|
||||||
bool isImpliedCond(Value *Cond, ICmpInst::Predicate Pred,
|
bool isImpliedCond(ICmpInst::Predicate Pred,
|
||||||
const SCEV *LHS, const SCEV *RHS,
|
const SCEV *LHS, const SCEV *RHS,
|
||||||
|
Value *FoundCondValue,
|
||||||
bool Inverse);
|
bool Inverse);
|
||||||
|
|
||||||
/// isImpliedCondOperands - Test whether the condition described by Pred,
|
/// isImpliedCondOperands - Test whether the condition described by Pred,
|
||||||
|
@ -5223,7 +5223,8 @@ ScalarEvolution::isLoopBackedgeGuardedByCond(const Loop *L,
|
|||||||
LoopContinuePredicate->isUnconditional())
|
LoopContinuePredicate->isUnconditional())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return isImpliedCond(LoopContinuePredicate->getCondition(), Pred, LHS, RHS,
|
return isImpliedCond(Pred, LHS, RHS,
|
||||||
|
LoopContinuePredicate->getCondition(),
|
||||||
LoopContinuePredicate->getSuccessor(0) != L->getHeader());
|
LoopContinuePredicate->getSuccessor(0) != L->getHeader());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5252,7 +5253,8 @@ ScalarEvolution::isLoopEntryGuardedByCond(const Loop *L,
|
|||||||
LoopEntryPredicate->isUnconditional())
|
LoopEntryPredicate->isUnconditional())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (isImpliedCond(LoopEntryPredicate->getCondition(), Pred, LHS, RHS,
|
if (isImpliedCond(Pred, LHS, RHS,
|
||||||
|
LoopEntryPredicate->getCondition(),
|
||||||
LoopEntryPredicate->getSuccessor(0) != Pair.second))
|
LoopEntryPredicate->getSuccessor(0) != Pair.second))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -5262,24 +5264,24 @@ ScalarEvolution::isLoopEntryGuardedByCond(const Loop *L,
|
|||||||
|
|
||||||
/// isImpliedCond - Test whether the condition described by Pred, LHS,
|
/// isImpliedCond - Test whether the condition described by Pred, LHS,
|
||||||
/// and RHS is true whenever the given Cond value evaluates to true.
|
/// and RHS is true whenever the given Cond value evaluates to true.
|
||||||
bool ScalarEvolution::isImpliedCond(Value *CondValue,
|
bool ScalarEvolution::isImpliedCond(ICmpInst::Predicate Pred,
|
||||||
ICmpInst::Predicate Pred,
|
|
||||||
const SCEV *LHS, const SCEV *RHS,
|
const SCEV *LHS, const SCEV *RHS,
|
||||||
|
Value *FoundCondValue,
|
||||||
bool Inverse) {
|
bool Inverse) {
|
||||||
// Recursively handle And and Or conditions.
|
// Recursively handle And and Or conditions.
|
||||||
if (BinaryOperator *BO = dyn_cast<BinaryOperator>(CondValue)) {
|
if (BinaryOperator *BO = dyn_cast<BinaryOperator>(FoundCondValue)) {
|
||||||
if (BO->getOpcode() == Instruction::And) {
|
if (BO->getOpcode() == Instruction::And) {
|
||||||
if (!Inverse)
|
if (!Inverse)
|
||||||
return isImpliedCond(BO->getOperand(0), Pred, LHS, RHS, Inverse) ||
|
return isImpliedCond(Pred, LHS, RHS, BO->getOperand(0), Inverse) ||
|
||||||
isImpliedCond(BO->getOperand(1), Pred, LHS, RHS, Inverse);
|
isImpliedCond(Pred, LHS, RHS, BO->getOperand(1), Inverse);
|
||||||
} else if (BO->getOpcode() == Instruction::Or) {
|
} else if (BO->getOpcode() == Instruction::Or) {
|
||||||
if (Inverse)
|
if (Inverse)
|
||||||
return isImpliedCond(BO->getOperand(0), Pred, LHS, RHS, Inverse) ||
|
return isImpliedCond(Pred, LHS, RHS, BO->getOperand(0), Inverse) ||
|
||||||
isImpliedCond(BO->getOperand(1), Pred, LHS, RHS, Inverse);
|
isImpliedCond(Pred, LHS, RHS, BO->getOperand(1), Inverse);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ICmpInst *ICI = dyn_cast<ICmpInst>(CondValue);
|
ICmpInst *ICI = dyn_cast<ICmpInst>(FoundCondValue);
|
||||||
if (!ICI) return false;
|
if (!ICI) return false;
|
||||||
|
|
||||||
// Bail if the ICmp's operands' types are wider than the needed type
|
// Bail if the ICmp's operands' types are wider than the needed type
|
||||||
|
Loading…
Reference in New Issue
Block a user