Skip to content

Commit

Permalink
Fix store numbering
Browse files Browse the repository at this point in the history
The load path needs to use the offset relative to
the store's target location.
  • Loading branch information
SingleAccretion committed Oct 21, 2022
1 parent 99ed47c commit 44238c8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/coreclr/jit/valuenum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4917,8 +4917,10 @@ void Compiler::fgValueNumberLocalStore(GenTree* storeNode,
// Avoid redundant bitcasts for the common case of a full definition.
fieldStoreType = fieldVarDsc->TypeGet();
}

ssize_t fieldValueOffset = max(0, fieldVarDsc->lvFldOffset - offset);
ValueNumPair fieldStoreValue =
vnStore->VNPairForLoad(value, storeSize, fieldStoreType, offset, fieldStoreSize);
vnStore->VNPairForLoad(value, storeSize, fieldStoreType, fieldValueOffset, fieldStoreSize);

processDef(fieldLclNum, lclDefNode->GetSsaNum(this, index), fieldStoreOffset, fieldStoreSize,
fieldStoreValue);
Expand Down

0 comments on commit 44238c8

Please sign in to comment.