Skip to content

JIT: Remove special handling for GT_INTRINSIC in gtTreeHasSideEffects #106257

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 12, 2024
Merged
Changes from all commits
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
52 changes: 15 additions & 37 deletions src/coreclr/jit/gentree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16866,50 +16866,28 @@ bool Compiler::gtTreeHasSideEffects(GenTree* tree, GenTreeFlags flags /* = GTF_S
return false;
}

if (sideEffectFlags == GTF_CALL)
if ((sideEffectFlags == GTF_CALL) && tree->IsHelperCall())
{
if (tree->IsHelperCall())
// Generally all trees that contain GT_CALL nodes are considered to have side-effects.
// However, for some pure helper calls we lie about this.
if (gtNodeHasSideEffects(tree, flags, ignoreCctors))
{
// Generally all trees that contain GT_CALL nodes are considered to have side-effects.
// However, for some pure helper calls we lie about this.
if (gtNodeHasSideEffects(tree, flags, ignoreCctors))
{
return true;
}

// The GTF_CALL may be contributed by an operand, so check for
// that.
bool hasCallInOperand = false;
tree->VisitOperands([=, &hasCallInOperand](GenTree* op) {
if (gtTreeHasSideEffects(op, GTF_CALL, ignoreCctors))
{
hasCallInOperand = true;
return GenTree::VisitResult::Abort;
}
return GenTree::VisitResult::Continue;
});

return hasCallInOperand;
return true;
}
else if (tree->OperIs(GT_INTRINSIC))
{
if (gtNodeHasSideEffects(tree, flags, ignoreCctors))
{
return true;
}

if (gtNodeHasSideEffects(tree->AsOp()->gtOp1, flags, ignoreCctors))
{
return true;
}

if ((tree->AsOp()->gtOp2 != nullptr) && gtNodeHasSideEffects(tree->AsOp()->gtOp2, flags, ignoreCctors))
// The GTF_CALL may be contributed by an operand, so check for
// that.
bool hasCallInOperand = false;
tree->VisitOperands([=, &hasCallInOperand](GenTree* op) {
if (gtTreeHasSideEffects(op, GTF_CALL, ignoreCctors))
{
return true;
hasCallInOperand = true;
return GenTree::VisitResult::Abort;
}
return GenTree::VisitResult::Continue;
});

return false;
}
return hasCallInOperand;
}

return true;
Expand Down
Loading