From 61ef8c09052bd6e6eaee9e03c595ff2d0a84aca9 Mon Sep 17 00:00:00 2001 From: SingleAccretion Date: Tue, 23 Nov 2021 23:25:14 +0300 Subject: [PATCH] Update hash of the new CSE when resizing 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 77eec238411812..b6dadaac185771 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;