@@ -71,7 +71,7 @@ GenTree* LC_Array::ToGenTree(Compiler* comp, BasicBlock* bb)
7171 int rank = GetDimRank ();
7272
7373 // rank is always 0 for spans
74- assert (!arrIndex->IsSpan () || (rank == 0 ));
74+ assert (!arrIndex->isSpan || (rank == 0 ));
7575
7676 for (int i = 0 ; i < rank; ++i)
7777 {
@@ -93,14 +93,7 @@ GenTree* LC_Array::ToGenTree(Compiler* comp, BasicBlock* bb)
9393 if (oper == ArrLen)
9494 {
9595 GenTree* arrLen;
96- if (arrIndex->isNonPromotedSpan )
97- {
98- // For non-promoted spans, we emit IND(ADD(arr, sizeof(ptr)))
99- GenTreeIntCon* offset = comp->gtNewIconNode (OFFSETOF__CORINFO_Span__length, TYP_I_IMPL);
100- GenTreeOp* addOffset = comp->gtNewOperNode (GT_ADD, TYP_BYREF, arr, offset);
101- arrLen = comp->gtNewIndir (TYP_INT, addOffset);
102- }
103- else if (arrIndex->isPromotedSpan )
96+ if (arrIndex->isSpan )
10497 {
10598 // For promoted spans, arr is already our length.
10699 assert (arr->OperIs (GT_LCL_VAR));
@@ -979,10 +972,10 @@ void LC_ArrayDeref::DeriveLevelConditions(JitExpandArrayStack<JitExpandArrayStac
979972{
980973 if (level == 0 )
981974 {
982- if (this ->array .arrIndex ->isPromotedSpan )
975+ if (this ->array .arrIndex ->isSpan )
983976 {
984- // For Spans (at least, for the promoted ones) we don't need "array != null" check
985- // but since the current algorithm doesn't expect that this condition might not be
977+ // For promoted Spans we don't need the "array != null" check.
978+ // However, the current algorithm doesn't expect that this condition might not be
986979 // needed, we insert a dummy always-true condition.
987980 //
988981 (*conds)[level]->Push (
@@ -997,7 +990,7 @@ void LC_ArrayDeref::DeriveLevelConditions(JitExpandArrayStack<JitExpandArrayStac
997990 }
998991 else
999992 {
1000- assert (!this ->array .arrIndex ->IsSpan () );
993+ assert (!this ->array .arrIndex ->isSpan );
1001994
1002995 // Adjust for level0 having just 1 condition and push conditions (i >= 0) && (i < a.len).
1003996 // We fold the two compares into one using unsigned compare, since we know a.len is non-negative.
@@ -1129,7 +1122,7 @@ bool Compiler::optDeriveLoopCloningConditions(FlowGraphNaturalLoop* loop, LoopCl
11291122 {
11301123 case LcOptInfo::LcJaggedArray:
11311124 // Keep a note that we might be dealing with a Span
1132- spanInvolved |= optInfo->AsLcJaggedArrayOptInfo ()->arrIndex .IsSpan () ;
1125+ spanInvolved |= optInfo->AsLcJaggedArrayOptInfo ()->arrIndex .isSpan ;
11331126 checkIterationBehavior = true ;
11341127 break ;
11351128
@@ -2285,43 +2278,23 @@ bool Compiler::optExtractArrIndex(GenTree* tree, ArrIndex* result, unsigned lhsN
22852278 return false ;
22862279 }
22872280
2288- bool isPromotedSpan = false ;
2289- bool isNonPromotedSpan = false ;
2281+ bool isSpan = false ;
22902282 unsigned arrLcl;
22912283 GenTree* arrLen = arrBndsChk->GetArrayLength ();
22922284 if (arrLen->OperIsArrLength () && arrLen->gtGetOp1 ()->OperIs (GT_LCL_VAR))
22932285 {
22942286 // Case 1: Arrays (jagged or multi-dimensional), Strings
22952287 arrLcl = arrLen->gtGetOp1 ()->AsLclVarCommon ()->GetLclNum ();
22962288 }
2297- else if (arrLen->OperIs (GT_IND) && arrLen->AsIndir ()->Addr ()->OperIs (GT_ADD))
2298- {
2299- // Case 2: Non-promoted spans (rare case)
2300- GenTree* add = arrLen->AsIndir ()->Addr ();
2301- if (add->gtGetOp1 ()->OperIs (GT_LCL_VAR) && add->gtGetOp2 ()->IsIntegralConst (OFFSETOF__CORINFO_Span__length))
2302- {
2303- arrLcl = add->gtGetOp1 ()->AsLclVarCommon ()->GetLclNum ();
2304- if (!lvaGetDesc (arrLcl)->IsSpan ())
2305- {
2306- return false ;
2307- }
2308- isNonPromotedSpan = true ;
2309- assert (arrLen->TypeIs (TYP_INT));
2310- }
2311- else
2312- {
2313- return false ;
2314- }
2315- }
23162289 else if (arrLen->OperIs (GT_LCL_VAR))
23172290 {
2318- // Case 3 : Promoted spans
2291+ // Case 2 : Promoted spans
23192292 arrLcl = arrLen->AsLclVarCommon ()->GetLclNum ();
23202293 if (!lvaGetDesc (arrLcl)->IsSpanLength ())
23212294 {
23222295 return false ;
23232296 }
2324- isPromotedSpan = true ;
2297+ isSpan = true ;
23252298 assert (arrLen->TypeIs (TYP_INT));
23262299 }
23272300 else
@@ -2338,10 +2311,9 @@ bool Compiler::optExtractArrIndex(GenTree* tree, ArrIndex* result, unsigned lhsN
23382311
23392312 if (lhsNum == BAD_VAR_NUM)
23402313 {
2341- result->arrLcl = arrLcl;
2342- result->isPromotedSpan = isPromotedSpan;
2343- result->isNonPromotedSpan = isNonPromotedSpan;
2314+ result->arrLcl = arrLcl;
23442315 }
2316+ result->isSpan = isSpan;
23452317 result->indLcls .Push (indLcl);
23462318 result->bndsChks .Push (tree);
23472319 result->useBlock = compCurBB;
0 commit comments