From 7f3ae69249546570fc2de6043e034542f73c1a73 Mon Sep 17 00:00:00 2001 From: SingleAccretion <62474226+SingleAccretion@users.noreply.github.com> Date: Fri, 4 Mar 2022 01:59:13 +0300 Subject: [PATCH] Fix copy propagation (#66070) Now that we don't push defs for shadowed parameters, we don't want to pop them as well. --- src/coreclr/jit/copyprop.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/coreclr/jit/copyprop.cpp b/src/coreclr/jit/copyprop.cpp index 991c658..bfc6d04 100644 --- a/src/coreclr/jit/copyprop.cpp +++ b/src/coreclr/jit/copyprop.cpp @@ -43,11 +43,13 @@ void Compiler::optBlockCopyPropPopStacks(BasicBlock* block, LclNumToLiveDefsMap* } CopyPropSsaDefStack* stack = nullptr; - curSsaName->Lookup(lclNum, &stack); - stack->Pop(); - if (stack->Empty()) + if (curSsaName->Lookup(lclNum, &stack)) { - curSsaName->Remove(lclNum); + stack->Pop(); + if (stack->Empty()) + { + curSsaName->Remove(lclNum); + } } } } -- 2.7.4