Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit f2a4886

Browse files
committed
Treat EDI as killed by MaskMove
It should really only be a fixed reference, not a kill, but if the reference is changed by `LinearScan::resolveConflictingDefAndUse()` it can fail to cause the value in EDI to be killed.
1 parent 074e9ca commit f2a4886

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

src/jit/lsra.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1112,8 +1112,11 @@ class LinearScan : public LinearScanInterface
11121112

11131113
static Compiler::fgWalkResult markAddrModeOperandsHelperMD(GenTree* tree, void* p);
11141114

1115-
// Helper for getKillSetForNode().
1115+
// Helpers for getKillSetForNode().
11161116
regMaskTP getKillSetForStoreInd(GenTreeStoreInd* tree);
1117+
#ifdef FEATURE_HW_INTRINSICS
1118+
regMaskTP getKillSetForHWIntrinsic(GenTreeHWIntrinsic* node);
1119+
#endif // FEATURE_HW_INTRINSICS
11171120

11181121
// Return the registers killed by the given tree node.
11191122
regMaskTP getKillSetForNode(GenTree* tree);

src/jit/lsrabuild.cpp

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,37 @@ regMaskTP LinearScan::getKillSetForStoreInd(GenTreeStoreInd* tree)
680680
return killMask;
681681
}
682682

683+
#ifdef FEATURE_HW_INTRINSICS
684+
//------------------------------------------------------------------------
685+
// getKillSetForHWIntrinsic: Determine the liveness kill set for a GT_STOREIND node.
686+
// If the GT_STOREIND will generate a write barrier, determine the specific kill
687+
// set required by the case-specific, platform-specific write barrier. If no
688+
// write barrier is required, the kill set will be RBM_NONE.
689+
//
690+
// Arguments:
691+
// tree - the GT_STOREIND node
692+
//
693+
// Return Value: a register mask of the registers killed
694+
//
695+
regMaskTP LinearScan::getKillSetForHWIntrinsic(GenTreeHWIntrinsic* node)
696+
{
697+
regMaskTP killMask = RBM_NONE;
698+
#ifdef _TARGET_XARCH_
699+
switch (node->gtHWIntrinsicId)
700+
{
701+
case NI_SSE2_MaskMove:
702+
killMask = RBM_EDI;
703+
break;
704+
705+
default:
706+
// Leave killMask as RBM_NONE
707+
break;
708+
}
709+
#endif // _TARGET_XARCH_
710+
return killMask;
711+
}
712+
#endif // FEATURE_HW_INTRINSICS
713+
683714
//------------------------------------------------------------------------
684715
// getKillSetForNode: Return the registers killed by the given tree node.
685716
//
@@ -853,6 +884,12 @@ regMaskTP LinearScan::getKillSetForNode(GenTree* tree)
853884
break;
854885
#endif // PROFILING_SUPPORTED
855886

887+
#ifdef FEATURE_HW_INTRINSICS
888+
case GT_HWIntrinsic:
889+
killMask = getKillSetForHWIntrinsic(tree->AsHWIntrinsic());
890+
break;
891+
#endif // FEATURE_HW_INTRINSICS
892+
856893
default:
857894
// for all other 'tree->OperGet()' kinds, leave 'killMask' = RBM_NONE
858895
break;

0 commit comments

Comments
 (0)