@@ -6266,28 +6266,15 @@ struct AAValueConstantRangeFloating : AAValueConstantRangeImpl {
62666266 return ;
62676267 }
62686268
6269- if (auto *I = dyn_cast<Instruction>(&V))
6270- if (isa<BinaryOperator>(I) || isa<CmpInst>(I)) {
6271- Value *LHS = I->getOperand (0 );
6272- Value *RHS = I->getOperand (1 );
6273-
6274- if (LHS->getType ()->isIntegerTy () && RHS->getType ()->isIntegerTy ())
6275- return ;
6276- }
6277-
6269+ if (isa<BinaryOperator>(&V) || isa<CmpInst>(&V) || isa<CastInst>(&V))
6270+ return ;
62786271 // If it is a load instruction with range metadata, use it.
62796272 if (LoadInst *LI = dyn_cast<LoadInst>(&V))
62806273 if (auto *RangeMD = LI->getMetadata (LLVMContext::MD_range)) {
62816274 intersectKnown (getConstantRangeFromMetadata (*RangeMD));
62826275 return ;
62836276 }
62846277
6285- // We handle casts in the updateImpl.
6286- // TODO: Allow non integers as well.
6287- if (CastInst *CI = dyn_cast<CastInst>(&V))
6288- if (CI->getOperand (0 )->getType ()->isIntegerTy ())
6289- return ;
6290-
62916278 // We can work with PHI and select instruction as we traverse their operands
62926279 // during update.
62936280 if (isa<SelectInst>(V) || isa<PHINode>(V))
@@ -6306,6 +6293,9 @@ struct AAValueConstantRangeFloating : AAValueConstantRangeImpl {
63066293 SmallVectorImpl<const AAValueConstantRange *> &QuerriedAAs) {
63076294 Value *LHS = BinOp->getOperand (0 );
63086295 Value *RHS = BinOp->getOperand (1 );
6296+ // TODO: Allow non integers as well.
6297+ if (!LHS->getType ()->isIntegerTy () || !RHS->getType ()->isIntegerTy ())
6298+ return false ;
63096299
63106300 auto &LHSAA =
63116301 A.getAAFor <AAValueConstantRange>(*this , IRPosition::value (*LHS));
@@ -6332,7 +6322,8 @@ struct AAValueConstantRangeFloating : AAValueConstantRangeImpl {
63326322 assert (CastI->getNumOperands () == 1 && " Expected cast to be unary!" );
63336323 // TODO: Allow non integers as well.
63346324 Value &OpV = *CastI->getOperand (0 );
6335- assert (OpV.getType ()->isIntegerTy () && " Expected integer cast" );
6325+ if (!OpV.getType ()->isIntegerTy ())
6326+ return false ;
63366327
63376328 auto &OpAA =
63386329 A.getAAFor <AAValueConstantRange>(*this , IRPosition::value (OpV));
@@ -6348,6 +6339,9 @@ struct AAValueConstantRangeFloating : AAValueConstantRangeImpl {
63486339 SmallVectorImpl<const AAValueConstantRange *> &QuerriedAAs) {
63496340 Value *LHS = CmpI->getOperand (0 );
63506341 Value *RHS = CmpI->getOperand (1 );
6342+ // TODO: Allow non integers as well.
6343+ if (!LHS->getType ()->isIntegerTy () || !RHS->getType ()->isIntegerTy ())
6344+ return false ;
63516345
63526346 auto &LHSAA =
63536347 A.getAAFor <AAValueConstantRange>(*this , IRPosition::value (*LHS));
0 commit comments