@@ -802,10 +802,11 @@ void LazyValueInfoImpl::intersectAssumeOrGuardBlockValueConstantRange(
802802}
803803
804804static ConstantRange getConstantRangeOrFull (const ValueLatticeElement &Val,
805- Type *Ty, const DataLayout &DL) {
805+ Type *Ty) {
806+ assert (Ty->isIntOrIntVectorTy () && " Must be integer type" );
806807 if (Val.isConstantRange (/* UndefAllowed*/ false ))
807808 return Val.getConstantRange ();
808- return ConstantRange::getFull (DL. getTypeSizeInBits (Ty ));
809+ return ConstantRange::getFull (Ty-> getScalarSizeInBits ( ));
809810}
810811
811812std::optional<ValueLatticeElement>
@@ -825,9 +826,9 @@ LazyValueInfoImpl::solveBlockValueSelect(SelectInst *SI, BasicBlock *BB) {
825826
826827 if (TrueVal.isConstantRange () || FalseVal.isConstantRange ()) {
827828 const ConstantRange &TrueCR =
828- getConstantRangeOrFull (TrueVal, SI->getType (), DL );
829+ getConstantRangeOrFull (TrueVal, SI->getType ());
829830 const ConstantRange &FalseCR =
830- getConstantRangeOrFull (FalseVal, SI->getType (), DL );
831+ getConstantRangeOrFull (FalseVal, SI->getType ());
831832 Value *LHS = nullptr ;
832833 Value *RHS = nullptr ;
833834 SelectPatternResult SPR = matchSelectPattern (SI, LHS, RHS);
@@ -898,7 +899,7 @@ LazyValueInfoImpl::getRangeFor(Value *V, Instruction *CxtI, BasicBlock *BB) {
898899 std::optional<ValueLatticeElement> OptVal = getBlockValue (V, BB, CxtI);
899900 if (!OptVal)
900901 return std::nullopt ;
901- return getConstantRangeOrFull (*OptVal, V->getType (), DL );
902+ return getConstantRangeOrFull (*OptVal, V->getType ());
902903}
903904
904905std::optional<ValueLatticeElement>
0 commit comments