From d9a578934827ec7792407b37852b1eb8fbf2b19b Mon Sep 17 00:00:00 2001 From: SingleAccretion <62474226+SingleAccretion@users.noreply.github.com> Date: Mon, 29 Nov 2021 15:29:52 +0300 Subject: [PATCH] Update hash of the new CSE when resizing (#61984) 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. --- src/coreclr/jit/optcse.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/coreclr/jit/optcse.cpp b/src/coreclr/jit/optcse.cpp index 77eec23841181..b6dadaac18577 100644 --- a/src/coreclr/jit/optcse.cpp +++ b/src/coreclr/jit/optcse.cpp @@ -655,6 +655,7 @@ unsigned Compiler::optValnumCSE_Index(GenTree* tree, Statement* stmt) } } + hval = optCSEKeyToHashIndex(key, newOptCSEhashSize); optCSEhash = newOptCSEhash; optCSEhashSize = newOptCSEhashSize; optCSEhashMaxCountBeforeResize = optCSEhashMaxCountBeforeResize * s_optCSEhashGrowthFactor;