Skip to content

Commit

Permalink
Update hash of the new CSE when resizing (#61984)
Browse files Browse the repository at this point in the history
The CSE logic maintains a custom hashtable implementation.

It triggers a resize at the same time as adding a new CSE,
but forgets the hash of the new CSE needs to be updated from
its pre-resize value. Failing to do so can lead to losing some
CSEs, though not in a correctness-impacting way.
  • Loading branch information
SingleAccretion committed Nov 29, 2021
1 parent a4cab7d commit d9a5789
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/coreclr/jit/optcse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,7 @@ unsigned Compiler::optValnumCSE_Index(GenTree* tree, Statement* stmt)
}
}

hval = optCSEKeyToHashIndex(key, newOptCSEhashSize);
optCSEhash = newOptCSEhash;
optCSEhashSize = newOptCSEhashSize;
optCSEhashMaxCountBeforeResize = optCSEhashMaxCountBeforeResize * s_optCSEhashGrowthFactor;
Expand Down

0 comments on commit d9a5789

Please sign in to comment.