summaryrefslogtreecommitdiff
path: root/src/jit/gentree.cpp
diff options
context:
space:
mode:
authorSergey Andreenko <seandree@microsoft.com>2019-04-27 13:01:09 -0700
committerGitHub <noreply@github.com>2019-04-27 13:01:09 -0700
commit46a064d2ff514fa9c68226dbc8a64fb539c9a5fd (patch)
tree349ec20da5bf4a922dbc1cbd15208fb90da06811 /src/jit/gentree.cpp
parent6af0b34cbaaf8a619254026e4db7ec3f28cff35a (diff)
parent3e271954768ec502d1827c18d911d046f234c5a1 (diff)
downloadcoreclr-46a064d2ff514fa9c68226dbc8a64fb539c9a5fd.tar.gz
coreclr-46a064d2ff514fa9c68226dbc8a64fb539c9a5fd.tar.bz2
coreclr-46a064d2ff514fa9c68226dbc8a64fb539c9a5fd.zip
Merge pull request #24261 from sandreenko/fixRegressionCoreFXx86
Fix optAssertionProp_Update.
Diffstat (limited to 'src/jit/gentree.cpp')
-rw-r--r--src/jit/gentree.cpp35
1 files changed, 20 insertions, 15 deletions
diff --git a/src/jit/gentree.cpp b/src/jit/gentree.cpp
index f0dfbc7ee5..df6b324a06 100644
--- a/src/jit/gentree.cpp
+++ b/src/jit/gentree.cpp
@@ -7931,23 +7931,32 @@ bool Compiler::gtCompareTree(GenTree* op1, GenTree* op2)
GenTree* Compiler::gtGetThisArg(GenTreeCall* call)
{
- if (call->gtCallObjp != nullptr)
+ GenTree* thisArg = call->gtCallObjp;
+ if (thisArg != nullptr)
{
- if (call->gtCallObjp->gtOper != GT_NOP && call->gtCallObjp->gtOper != GT_ASG)
+ if (thisArg->OperIs(GT_NOP, GT_ASG) == false)
{
- if (!(call->gtCallObjp->gtFlags & GTF_LATE_ARG))
+ if ((thisArg->gtFlags & GTF_LATE_ARG) == 0)
{
return call->gtCallObjp;
}
}
- if (call->gtCallLateArgs)
+ if (call->gtCallLateArgs != nullptr)
{
unsigned argNum = 0;
fgArgTabEntry* thisArgTabEntry = gtArgEntryByArgNum(call, argNum);
GenTree* result = thisArgTabEntry->node;
+ // Assert if we used DEBUG_DESTROY_NODE.
+ assert(result->gtOper != GT_COUNT);
+
#if !FEATURE_FIXED_OUT_ARGS && defined(DEBUG)
+ // Check that call->fgArgInfo used in gtArgEntryByArgNum was not
+ // left outdated by assertion propogation updates.
+ // There is no information about registers of late args for platforms
+ // with FEATURE_FIXED_OUT_ARGS that is why this debug check is under
+ // !FEATURE_FIXED_OUT_ARGS.
regNumber thisReg = REG_ARG_0;
GenTree* lateArgs = call->gtCallLateArgs;
regList list = call->regArgList;
@@ -7966,6 +7975,7 @@ GenTree* Compiler::gtGetThisArg(GenTreeCall* call)
index++;
}
#endif // !FEATURE_FIXED_OUT_ARGS && defined(DEBUG)
+
return result;
}
}
@@ -15156,42 +15166,37 @@ Compiler::fgWalkResult Compiler::gtClearColonCond(GenTree** pTree, fgWalkData* d
return WALK_CONTINUE;
}
-struct FindLinkData
-{
- GenTree* nodeToFind;
- GenTree** result;
-};
-
/*****************************************************************************
*
* Callback used by the tree walker to implement fgFindLink()
*/
static Compiler::fgWalkResult gtFindLinkCB(GenTree** pTree, Compiler::fgWalkData* cbData)
{
- FindLinkData* data = (FindLinkData*)cbData->pCallbackData;
+ Compiler::FindLinkData* data = (Compiler::FindLinkData*)cbData->pCallbackData;
if (*pTree == data->nodeToFind)
{
data->result = pTree;
+ data->parent = cbData->parent;
return Compiler::WALK_ABORT;
}
return Compiler::WALK_CONTINUE;
}
-GenTree** Compiler::gtFindLink(GenTreeStmt* stmt, GenTree* node)
+Compiler::FindLinkData Compiler::gtFindLink(GenTreeStmt* stmt, GenTree* node)
{
- FindLinkData data = {node, nullptr};
+ FindLinkData data = {node, nullptr, nullptr};
fgWalkResult result = fgWalkTreePre(&stmt->gtStmtExpr, gtFindLinkCB, &data);
if (result == WALK_ABORT)
{
assert(data.nodeToFind == *data.result);
- return data.result;
+ return data;
}
else
{
- return nullptr;
+ return {node, nullptr, nullptr};
}
}