forked from OSchip/llvm-project
[SCEV][NFC] Split out type balancing in implication engine
We plan to introduce more advanced ways of dealing with different types.
This commit is contained in:
parent
5e09c45cbb
commit
1eb2c6d23f
|
@ -1695,11 +1695,21 @@ private:
|
|||
/// Test whether the condition described by Pred, LHS, and RHS is true
|
||||
/// whenever the given FoundCondValue value evaluates to true in given
|
||||
/// Context. If Context is nullptr, then the found predicate is true
|
||||
/// everywhere.
|
||||
/// everywhere. LHS and FoundLHS may have different type width.
|
||||
bool isImpliedCond(ICmpInst::Predicate Pred, const SCEV *LHS, const SCEV *RHS,
|
||||
const Value *FoundCondValue, bool Inverse,
|
||||
const Instruction *Context = nullptr);
|
||||
|
||||
/// Test whether the condition described by Pred, LHS, and RHS is true
|
||||
/// whenever the given FoundCondValue value evaluates to true in given
|
||||
/// Context. If Context is nullptr, then the found predicate is true
|
||||
/// everywhere. LHS and FoundLHS must have same type width.
|
||||
bool isImpliedCondBalancedTypes(ICmpInst::Predicate Pred, const SCEV *LHS,
|
||||
const SCEV *RHS,
|
||||
ICmpInst::Predicate FoundPred,
|
||||
const SCEV *FoundLHS, const SCEV *FoundRHS,
|
||||
const Instruction *Context);
|
||||
|
||||
/// Test whether the condition described by Pred, LHS, and RHS is true
|
||||
/// whenever the condition described by FoundPred, FoundLHS, FoundRHS is
|
||||
/// true in given Context. If Context is nullptr, then the found predicate is
|
||||
|
|
|
@ -9765,7 +9765,17 @@ bool ScalarEvolution::isImpliedCond(ICmpInst::Predicate Pred, const SCEV *LHS,
|
|||
FoundRHS = getZeroExtendExpr(FoundRHS, LHS->getType());
|
||||
}
|
||||
}
|
||||
return isImpliedCondBalancedTypes(Pred, LHS, RHS, FoundPred, FoundLHS,
|
||||
FoundRHS, Context);
|
||||
}
|
||||
|
||||
bool ScalarEvolution::isImpliedCondBalancedTypes(
|
||||
ICmpInst::Predicate Pred, const SCEV *LHS, const SCEV *RHS,
|
||||
ICmpInst::Predicate FoundPred, const SCEV *FoundLHS, const SCEV *FoundRHS,
|
||||
const Instruction *Context) {
|
||||
assert(getTypeSizeInBits(LHS->getType()) ==
|
||||
getTypeSizeInBits(FoundLHS->getType()) &&
|
||||
"Types should be balanced!");
|
||||
// Canonicalize the query to match the way instcombine will have
|
||||
// canonicalized the comparison.
|
||||
if (SimplifyICmpOperands(Pred, LHS, RHS))
|
||||
|
|
Loading…
Reference in New Issue