@@ -258,7 +258,8 @@ GenTree* DecomposeLongs::DecomposeNode(LIR::Use& use)
258
258
#ifdef DEBUG
259
259
if (m_compiler->verbose )
260
260
{
261
- printf (" AFTER:\n " );
261
+ // NOTE: st_lcl_var doesn't dump properly afterwards.
262
+ printf (" Decomposing TYP_LONG tree. AFTER:\n " );
262
263
m_compiler->gtDispTree (use.Def ());
263
264
}
264
265
#endif
@@ -275,7 +276,8 @@ GenTree* DecomposeLongs::DecomposeNode(LIR::Use& use)
275
276
// Arguments:
276
277
// use - the LIR::Use object for the def that needs to be decomposed.
277
278
// loResult - the decomposed low part
278
- // hiResult - the decomposed high part
279
+ // hiResult - the decomposed high part. This must follow loResult in the linear order,
280
+ // as the new GT_LONG node will be inserted immediately after it.
279
281
//
280
282
// Return Value:
281
283
// The next node to process.
@@ -294,7 +296,7 @@ GenTree* DecomposeLongs::FinalizeDecomposition(LIR::Use& use, GenTree* loResult,
294
296
295
297
use.ReplaceWith (m_compiler, gtLong);
296
298
297
- return gtLong;
299
+ return gtLong-> gtNext ;
298
300
}
299
301
300
302
@@ -434,6 +436,10 @@ GenTree* DecomposeLongs::DecomposeStoreLclVar(LIR::Use& use)
434
436
hiStore->AsLclFld ()->gtFieldSeq = FieldSeqStore::NotAField ();
435
437
}
436
438
439
+ // 'tree' is going to steal the loRhs node for itself, so we need to remove the
440
+ // GT_LONG node from the threading.
441
+ m_blockRange.Remove (rhs);
442
+
437
443
tree->gtOp .gtOp1 = loRhs;
438
444
tree->gtType = TYP_INT;
439
445
@@ -445,7 +451,7 @@ GenTree* DecomposeLongs::DecomposeStoreLclVar(LIR::Use& use)
445
451
446
452
m_blockRange.InsertAfter (hiStore, tree);
447
453
448
- return hiStore;
454
+ return hiStore-> gtNext ;
449
455
}
450
456
451
457
@@ -796,6 +802,7 @@ GenTree* DecomposeLongs::DecomposeInd(LIR::Use& use)
796
802
GenTreePtr indHigh = new (m_compiler, GT_IND) GenTreeIndir (GT_IND, TYP_INT, addrHigh, nullptr );
797
803
798
804
// Insert the nodes into the block
805
+ m_blockRange.InsertAfter (addrBaseHigh, indLow);
799
806
m_blockRange.InsertAfter (addrHigh, addrBaseHigh);
800
807
m_blockRange.InsertAfter (indHigh, addrHigh);
801
808
0 commit comments