Skip to content

Commit 44238c8

Browse files
Fix store numbering
The load path needs to use the offset relative to the store's target location.
1 parent 99ed47c commit 44238c8

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/coreclr/jit/valuenum.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4917,8 +4917,10 @@ void Compiler::fgValueNumberLocalStore(GenTree* storeNode,
49174917
// Avoid redundant bitcasts for the common case of a full definition.
49184918
fieldStoreType = fieldVarDsc->TypeGet();
49194919
}
4920+
4921+
ssize_t fieldValueOffset = max(0, fieldVarDsc->lvFldOffset - offset);
49204922
ValueNumPair fieldStoreValue =
4921-
vnStore->VNPairForLoad(value, storeSize, fieldStoreType, offset, fieldStoreSize);
4923+
vnStore->VNPairForLoad(value, storeSize, fieldStoreType, fieldValueOffset, fieldStoreSize);
49224924

49234925
processDef(fieldLclNum, lclDefNode->GetSsaNum(this, index), fieldStoreOffset, fieldStoreSize,
49244926
fieldStoreValue);

0 commit comments

Comments
 (0)