@@ -1775,8 +1775,8 @@ ConstantRange LazyValueInfo::getConstantRangeOnEdge(Value *V,
1775
1775
}
1776
1776
1777
1777
static LazyValueInfo::Tristate
1778
- getPredicateResult (unsigned Pred, Constant *C, const ValueLatticeElement &Val ,
1779
- const DataLayout &DL) {
1778
+ getPredicateResult (CmpInst::Predicate Pred, Constant *C,
1779
+ const ValueLatticeElement &Val, const DataLayout &DL) {
1780
1780
// If we know the value is a constant, evaluate the conditional.
1781
1781
Constant *Res = nullptr ;
1782
1782
if (Val.isConstant ()) {
@@ -1805,8 +1805,8 @@ getPredicateResult(unsigned Pred, Constant *C, const ValueLatticeElement &Val,
1805
1805
return LazyValueInfo::False;
1806
1806
} else {
1807
1807
// Handle more complex predicates.
1808
- ConstantRange TrueValues = ConstantRange::makeExactICmpRegion (
1809
- (ICmpInst::Predicate) Pred, CI->getValue ());
1808
+ ConstantRange TrueValues =
1809
+ ConstantRange::makeExactICmpRegion ( Pred, CI->getValue ());
1810
1810
if (TrueValues.contains (CR))
1811
1811
return LazyValueInfo::True;
1812
1812
if (TrueValues.inverse ().contains (CR))
@@ -1840,19 +1840,20 @@ getPredicateResult(unsigned Pred, Constant *C, const ValueLatticeElement &Val,
1840
1840
// / Determine whether the specified value comparison with a constant is known to
1841
1841
// / be true or false on the specified CFG edge. Pred is a CmpInst predicate.
1842
1842
LazyValueInfo::Tristate
1843
- LazyValueInfo::getPredicateOnEdge (unsigned Pred, Value *V, Constant *C ,
1844
- BasicBlock *FromBB , BasicBlock *ToBB ,
1845
- Instruction *CxtI) {
1843
+ LazyValueInfo::getPredicateOnEdge (CmpInst::Predicate Pred, Value *V,
1844
+ Constant *C , BasicBlock *FromBB ,
1845
+ BasicBlock *ToBB, Instruction *CxtI) {
1846
1846
Module *M = FromBB->getModule ();
1847
1847
ValueLatticeElement Result =
1848
1848
getOrCreateImpl (M).getValueOnEdge (V, FromBB, ToBB, CxtI);
1849
1849
1850
1850
return getPredicateResult (Pred, C, Result, M->getDataLayout ());
1851
1851
}
1852
1852
1853
- LazyValueInfo::Tristate
1854
- LazyValueInfo::getPredicateAt (unsigned Pred, Value *V, Constant *C,
1855
- Instruction *CxtI, bool UseBlockValue) {
1853
+ LazyValueInfo::Tristate LazyValueInfo::getPredicateAt (CmpInst::Predicate Pred,
1854
+ Value *V, Constant *C,
1855
+ Instruction *CxtI,
1856
+ bool UseBlockValue) {
1856
1857
// Is or is not NonNull are common predicates being queried. If
1857
1858
// isKnownNonZero can tell us the result of the predicate, we can
1858
1859
// return it quickly. But this is only a fastpath, and falling
@@ -1956,14 +1957,12 @@ LazyValueInfo::getPredicateAt(unsigned Pred, Value *V, Constant *C,
1956
1957
return Unknown;
1957
1958
}
1958
1959
1959
- LazyValueInfo::Tristate LazyValueInfo::getPredicateAt (unsigned P, Value *LHS ,
1960
- Value *RHS,
1960
+ LazyValueInfo::Tristate LazyValueInfo::getPredicateAt (CmpInst::Predicate Pred ,
1961
+ Value *LHS, Value * RHS,
1961
1962
Instruction *CxtI,
1962
1963
bool UseBlockValue) {
1963
- CmpInst::Predicate Pred = (CmpInst::Predicate)P;
1964
-
1965
1964
if (auto *C = dyn_cast<Constant>(RHS))
1966
- return getPredicateAt (P , LHS, C, CxtI, UseBlockValue);
1965
+ return getPredicateAt (Pred , LHS, C, CxtI, UseBlockValue);
1967
1966
if (auto *C = dyn_cast<Constant>(LHS))
1968
1967
return getPredicateAt (CmpInst::getSwappedPredicate (Pred), RHS, C, CxtI,
1969
1968
UseBlockValue);
@@ -1981,8 +1980,7 @@ LazyValueInfo::Tristate LazyValueInfo::getPredicateAt(unsigned P, Value *LHS,
1981
1980
ValueLatticeElement R =
1982
1981
getOrCreateImpl (M).getValueInBlock (RHS, CxtI->getParent (), CxtI);
1983
1982
Type *Ty = CmpInst::makeCmpResultType (LHS->getType ());
1984
- if (Constant *Res = L.getCompare ((CmpInst::Predicate)P, Ty, R,
1985
- M->getDataLayout ())) {
1983
+ if (Constant *Res = L.getCompare (Pred, Ty, R, M->getDataLayout ())) {
1986
1984
if (Res->isNullValue ())
1987
1985
return LazyValueInfo::False;
1988
1986
if (Res->isOneValue ())
0 commit comments