@@ -1058,12 +1058,17 @@ Range RangeCheck::GetRangeFromAssertionsWorker(Compiler*
10581058 }
10591059 }
10601060
1061- // If it was evaluated to a single constant value by now, return it.
1062- // We can't do better anyway.
10631061 if (result.IsSingleValueConstant ())
10641062 {
1063+ // If it was evaluated to a single constant value by now, return it, we can't do better anyway.
10651064 return result;
10661065 }
1066+ else if (!result.IsConstantRange ())
1067+ {
1068+ // Otherwise if it isn't a constant range, skip the remaining merging
1069+ assert (varTypeIsLong (vnType));
1070+ return Limit (Limit::keUnknown);
1071+ }
10671072
10681073 Range phiRange = Range (Limit (Limit::keUndef));
10691074 auto visitor = [comp, &phiRange, &budget, visited](ValueNum reachingVN, ASSERT_TP reachingAssertions) {
@@ -2320,12 +2325,6 @@ Range RangeCheck::ComputeRange(BasicBlock* block, GenTree* expr, bool monIncreas
23202325 range = Range (Limit (Limit::keUnknown));
23212326 JITDUMP (" GetRangeWorker not tractable within max stack depth.\n " );
23222327 }
2323- // TYP_LONG is not supported anyway.
2324- else if (expr->TypeIs (TYP_LONG))
2325- {
2326- range = Range (Limit (Limit::keUnknown));
2327- JITDUMP (" GetRangeWorker long, setting to unknown value.\n " );
2328- }
23292328 // If VN is constant return range as constant.
23302329 else if (m_compiler->vnStore ->IsVNConstant (vn))
23312330 {
@@ -2402,16 +2401,11 @@ Range RangeCheck::ComputeRange(BasicBlock* block, GenTree* expr, bool monIncreas
24022401 range = Range (Limit (Limit::keConstant, 0 ), Limit (Limit::keConstant, CORINFO_Array_MaxLength));
24032402 }
24042403 }
2405- else if ( genActualType (expr) == TYP_INT)
2404+ else
24062405 {
24072406 // Use GetRangeFromAssertions for everything else since they won't produce dependent or symbolic ranges
24082407 range = GetRangeFromAssertions (m_compiler, expr->TypeGet (), vn, block->bbAssertionIn );
24092408 }
2410- else
2411- {
2412- // The expression is not recognized, so the result is unknown.
2413- range = Range (Limit (Limit::keUnknown));
2414- }
24152409
24162410 GetRangeMap ()->Set (expr, new (m_alloc) Range (range), RangeMap::Overwrite);
24172411 GetSearchPath ()->Remove (expr);
0 commit comments