@@ -802,10 +802,11 @@ void LazyValueInfoImpl::intersectAssumeOrGuardBlockValueConstantRange(
802
802
}
803
803
804
804
static ConstantRange getConstantRangeOrFull (const ValueLatticeElement &Val,
805
- Type *Ty, const DataLayout &DL) {
805
+ Type *Ty) {
806
+ assert (Ty->isIntOrIntVectorTy () && " Must be integer type" );
806
807
if (Val.isConstantRange (/* UndefAllowed*/ false ))
807
808
return Val.getConstantRange ();
808
- return ConstantRange::getFull (DL. getTypeSizeInBits (Ty ));
809
+ return ConstantRange::getFull (Ty-> getScalarSizeInBits ( ));
809
810
}
810
811
811
812
std::optional<ValueLatticeElement>
@@ -825,9 +826,9 @@ LazyValueInfoImpl::solveBlockValueSelect(SelectInst *SI, BasicBlock *BB) {
825
826
826
827
if (TrueVal.isConstantRange () || FalseVal.isConstantRange ()) {
827
828
const ConstantRange &TrueCR =
828
- getConstantRangeOrFull (TrueVal, SI->getType (), DL );
829
+ getConstantRangeOrFull (TrueVal, SI->getType ());
829
830
const ConstantRange &FalseCR =
830
- getConstantRangeOrFull (FalseVal, SI->getType (), DL );
831
+ getConstantRangeOrFull (FalseVal, SI->getType ());
831
832
Value *LHS = nullptr ;
832
833
Value *RHS = nullptr ;
833
834
SelectPatternResult SPR = matchSelectPattern (SI, LHS, RHS);
@@ -898,7 +899,7 @@ LazyValueInfoImpl::getRangeFor(Value *V, Instruction *CxtI, BasicBlock *BB) {
898
899
std::optional<ValueLatticeElement> OptVal = getBlockValue (V, BB, CxtI);
899
900
if (!OptVal)
900
901
return std::nullopt;
901
- return getConstantRangeOrFull (*OptVal, V->getType (), DL );
902
+ return getConstantRangeOrFull (*OptVal, V->getType ());
902
903
}
903
904
904
905
std::optional<ValueLatticeElement>
0 commit comments