Skip to content

Commit

Permalink
assign vn for COMMA in gtWrapWithSideEffects
Browse files Browse the repository at this point in the history
  • Loading branch information
egorbot committed Oct 17, 2024
1 parent 9e1edb7 commit d4b6862
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
13 changes: 1 addition & 12 deletions src/coreclr/jit/assertionprop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3102,18 +3102,7 @@ GenTree* Compiler::optVNBasedFoldConstExpr(BasicBlock* block, GenTree* parent, G

// Were able to optimize.
conValTree->gtVNPair = vnPair;
GenTree* sideEffList = optExtractSideEffListFromConst(tree);
if (sideEffList != nullptr)
{
// Replace as COMMA(side_effects, const value tree);
assert((sideEffList->gtFlags & GTF_SIDE_EFFECT) != 0);
return gtNewOperNode(GT_COMMA, conValTree->TypeGet(), sideEffList, conValTree);
}
else
{
// No side effects, replace as const value tree.
return conValTree;
}
return gtWrapWithSideEffects(conValTree, tree);
}
else
{
Expand Down
4 changes: 3 additions & 1 deletion src/coreclr/jit/gentree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17223,7 +17223,9 @@ GenTree* Compiler::gtWrapWithSideEffects(GenTree* tree,
// It should be possible to be smarter here and allow such cases by extracting the side effects
// properly for this particular case. For now, caller is responsible for avoiding such cases.

tree = gtNewOperNode(GT_COMMA, tree->TypeGet(), sideEffects, tree);
GenTree* comma = gtNewOperNode(GT_COMMA, tree->TypeGet(), sideEffects, tree);
comma->gtVNPair = tree->gtVNPair;
return comma;
}
return tree;
}
Expand Down

0 comments on commit d4b6862

Please sign in to comment.