Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 5 additions & 14 deletions src/coreclr/jit/morph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8028,10 +8028,7 @@ GenTree* Compiler::fgMorphSmpOp(GenTree* tree, MorphAddrContext* mac, bool* optA

GenTree* oldTree = tree;

if (opts.OptimizationEnabled())
{
tree = gtFoldExpr(tree);
}
tree = gtFoldExpr(tree);

// Were we able to fold it ?
// Note that gtFoldExpr may return a non-leaf even if successful
Expand Down Expand Up @@ -8330,11 +8327,8 @@ GenTree* Compiler::fgMorphSmpOp(GenTree* tree, MorphAddrContext* mac, bool* optA
qmarkOp2 = oldTree->AsOp()->gtOp2->AsOp()->gtOp2;
}

if (opts.OptimizationEnabled())
{
// Try to fold it, maybe we get lucky,
tree = gtFoldExpr(tree);
}
// Try to fold it, maybe we get lucky,
tree = gtFoldExpr(tree);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a similar check for hwintrinsic, right? Should that be included in this or as well?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, looks like those are fine as is


if (oldTree != tree)
{
Expand Down Expand Up @@ -12360,11 +12354,8 @@ GenTree* Compiler::fgMorphTree(GenTree* tree, MorphAddrContext* mac)
tree->gtFlags |= tree->AsConditional()->gtOp1->gtFlags & GTF_ALL_EFFECT;
tree->gtFlags |= tree->AsConditional()->gtOp2->gtFlags & GTF_ALL_EFFECT;

if (opts.OptimizationEnabled())
{
// Try to fold away any constants etc.
tree = gtFoldExpr(tree);
}
// Try to fold away any constants etc.
tree = gtFoldExpr(tree);

break;

Expand Down