Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix an oooold bug in VN.
For a tree like:
```
N005 ( 11, 10) [001400] -A------R----             *  ASG       long
N004 (  6,  5) [001401] *------N-----             +--*  IND       long
N003 (  3,  3) [001402] -------------             |  \--*  ADDR      byref  Zero Fseq[_00]
N002 (  3,  2) [001403] U------N-----             |     \--*  LCL_VAR   struct<System.Runtime.Intrinsics.Vector128`1[Byte], 16> V45 tmp38        ud:3->4
N001 (  1,  1) [001404] -------------             \--*  LCL_VAR   long   V69 tmp62        u:2 (last use)
```
SSA was working correctly and printing that `001403` is using SSA-3 and defining SSA-4. However, this code, for some reason, was writing result as a define for SSA-3.
  • Loading branch information
Sergey committed Aug 24, 2021
commit 34c4edbaca2e7e983f2e893b680be5412c94ec59
4 changes: 1 addition & 3 deletions src/coreclr/jit/valuenum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8007,12 +8007,11 @@ void Compiler::fgValueNumberTree(GenTree* tree)
rhsVNPair.SetBoth(vnStore->VNForExpr(compCurBB, lclVarTree->TypeGet()));
}

unsigned lclDefSsaNum;
unsigned lclDefSsaNum = GetSsaNumForLocalVarDef(lclVarTree);
ValueNumPair newLhsVNPair;
if (isEntire)
{
newLhsVNPair = rhsVNPair;
lclDefSsaNum = lclVarTree->GetSsaNum();
}
else
{
Expand All @@ -8021,7 +8020,6 @@ void Compiler::fgValueNumberTree(GenTree* tree)
ValueNumPair oldLhsVNPair = lvaTable[lclVarTree->GetLclNum()]
.GetPerSsaData(lclVarTree->GetSsaNum())
->m_vnPair;
lclDefSsaNum = GetSsaNumForLocalVarDef(lclVarTree);
newLhsVNPair =
vnStore->VNPairApplySelectorsAssign(oldLhsVNPair, fieldSeq, rhsVNPair,
lhs->TypeGet(), compCurBB);
Expand Down