From bda8c8dae5354302803f2f2b6393108a9eec8c61 Mon Sep 17 00:00:00 2001 From: Jakob Botsch Nielsen Date: Tue, 31 Jan 2023 17:54:22 +0100 Subject: [PATCH] JIT: Skip LSRA inserted nodes in gcIsWriteBarrierCandidate (#81423) gcIsWriteBarrierCandidate is expected to return the same results during LSRA and during codegen, so it needs to skip GT_COPY and GT_RELOAD inserted on top of the data node. Fix #77141 Fix #77143 --- src/coreclr/jit/gcinfo.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/coreclr/jit/gcinfo.cpp b/src/coreclr/jit/gcinfo.cpp index 2947053..97fc0a7 100644 --- a/src/coreclr/jit/gcinfo.cpp +++ b/src/coreclr/jit/gcinfo.cpp @@ -240,7 +240,8 @@ GCInfo::WriteBarrierForm GCInfo::gcIsWriteBarrierCandidate(GenTreeStoreInd* stor } // Ignore any assignments of NULL. - if ((store->Data()->GetVN(VNK_Liberal) == ValueNumStore::VNForNull()) || store->Data()->IsIntegralConst(0)) + GenTree* data = store->Data()->gtSkipReloadOrCopy(); + if ((data->GetVN(VNK_Liberal) == ValueNumStore::VNForNull()) || data->IsIntegralConst(0)) { return WBF_NoBarrier; } @@ -253,7 +254,7 @@ GCInfo::WriteBarrierForm GCInfo::gcIsWriteBarrierCandidate(GenTreeStoreInd* stor } // Write-barriers are no-op for frozen objects (as values) - if (store->Data()->IsIconHandle(GTF_ICON_OBJ_HDL)) + if (data->IsIconHandle(GTF_ICON_OBJ_HDL)) { // Ignore frozen objects return WBF_NoBarrier; -- 2.7.4