From: Sergey Andreenko Date: Fri, 26 Apr 2019 20:53:26 +0000 (-0700) Subject: Use `ReplaceOperand`. X-Git-Tag: submit/tizen/20210909.063632~11030^2~1696^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b5867fc334f284425277635995c199a879443ea6;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Use `ReplaceOperand`. Commit migrated from https://github.com/dotnet/coreclr/commit/0bf52e4304b5e13aaa40ec248a16f06db8d892ae --- diff --git a/src/coreclr/src/jit/assertionprop.cpp b/src/coreclr/src/jit/assertionprop.cpp index 61caa67..d569458 100644 --- a/src/coreclr/src/jit/assertionprop.cpp +++ b/src/coreclr/src/jit/assertionprop.cpp @@ -3902,37 +3902,18 @@ GenTree* Compiler::optAssertionProp_Update(GenTree* newTree, GenTree* tree, GenT if (newTree != tree) { FindLinkData linkData = gtFindLink(stmt, tree); - GenTree** link = linkData.result; - noway_assert(link != nullptr); + GenTree** useEdge = linkData.result; + GenTree* parent = linkData.parent; + noway_assert(useEdge != nullptr); + assert(parent != nullptr); - // Replace the old operand with the newTree - *link = newTree; + parent->ReplaceOperand(useEdge, newTree); // We only need to ensure that the gtNext field is set as it is used to traverse // to the next node in the tree. We will re-morph this entire statement in // optAssertionPropMain(). It will reset the gtPrev and gtNext links for all nodes. newTree->gtNext = tree->gtNext; - if ((linkData.parent != nullptr) && linkData.parent->IsCall()) - { - GenTreeCall* parentCall = linkData.parent->AsCall(); - // Other functions can access call->fgArgInfo for other trees in the current statement - // before they are remorphed in optVNAssertionPropCurStmt, so we need to make sure - // that these links are updated. - fgArgInfo* argInfo = parentCall->fgArgInfo; - if (argInfo != nullptr) - { - for (unsigned i = 0; i < argInfo->ArgCount(); ++i) - { - fgArgTabEntry* argTabEntry = argInfo->ArgTable()[i]; - if (argTabEntry->node == tree) - { - argTabEntry->node = newTree; - } - } - } - } - // Old tree should not be referenced anymore. DEBUG_DESTROY_NODE(tree); }