From f780ddabeb75b2416723bd96f38b361c682c3038 Mon Sep 17 00:00:00 2001 From: Carol Eidt Date: Tue, 3 Jul 2018 07:42:12 -0700 Subject: [PATCH] Build uses for atomic ops Fix #18765 --- src/jit/lsraarm64.cpp | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/jit/lsraarm64.cpp b/src/jit/lsraarm64.cpp index bf68d0b09f..6fe9d06d4e 100644 --- a/src/jit/lsraarm64.cpp +++ b/src/jit/lsraarm64.cpp @@ -434,13 +434,16 @@ int LinearScan::BuildNode(GenTree* tree) setDelayFree(locationUse); RefPosition* valueUse = BuildUse(tree->gtCmpXchg.gtOpValue); setDelayFree(valueUse); - if (!cmpXchgNode->gtOpComparand->isContained() && !compiler->compSupports(InstructionSet_Atomics)) + if (!cmpXchgNode->gtOpComparand->isContained()) { + RefPosition* comparandUse = BuildUse(tree->gtCmpXchg.gtOpComparand); + // For ARMv8 exclusives the lifetime of the comparand must be extended because // it may be used used multiple during retries - - RefPosition* comparandUse = BuildUse(tree->gtCmpXchg.gtOpComparand); - setDelayFree(comparandUse); + if (!compiler->compSupports(InstructionSet_Atomics)) + { + setDelayFree(comparandUse); + } } // Internals may not collide with target @@ -465,17 +468,20 @@ int LinearScan::BuildNode(GenTree* tree) { buildInternalIntRegisterDefForNode(tree); } + } - // For ARMv8 exclusives the lifetime of the addr and data must be extended because - // it may be used used multiple during retries - assert(!tree->gtGetOp1()->isContained()); - RefPosition* op1Use = BuildUse(tree->gtGetOp1()); - RefPosition* op2Use = nullptr; - if (!tree->gtGetOp2()->isContained()) - { - op2Use = BuildUse(tree->gtGetOp2()); - } + assert(!tree->gtGetOp1()->isContained()); + RefPosition* op1Use = BuildUse(tree->gtGetOp1()); + RefPosition* op2Use = nullptr; + if (!tree->gtGetOp2()->isContained()) + { + op2Use = BuildUse(tree->gtGetOp2()); + } + // For ARMv8 exclusives the lifetime of the addr and data must be extended because + // it may be used used multiple during retries + if (!compiler->compSupports(InstructionSet_Atomics)) + { // Internals may not collide with target if (dstCount == 1) { -- 2.34.1