summaryrefslogtreecommitdiff
path: root/src/jit/assertionprop.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/jit/assertionprop.cpp')
-rw-r--r--src/jit/assertionprop.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/jit/assertionprop.cpp b/src/jit/assertionprop.cpp
index 3d5e0edd15..61caa67cbb 100644
--- a/src/jit/assertionprop.cpp
+++ b/src/jit/assertionprop.cpp
@@ -3913,6 +3913,26 @@ GenTree* Compiler::optAssertionProp_Update(GenTree* newTree, GenTree* tree, GenT
// 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);
}