Skip to content

Commit 714be4b

Browse files
authored
JIT: Remove special handling for GT_INTRINSIC in gtTreeHasSideEffects (#106257)
This handling is wrong. Fix #106187
1 parent e29ffeb commit 714be4b

File tree

1 file changed

+15
-37
lines changed

1 file changed

+15
-37
lines changed

src/coreclr/jit/gentree.cpp

Lines changed: 15 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -16866,50 +16866,28 @@ bool Compiler::gtTreeHasSideEffects(GenTree* tree, GenTreeFlags flags /* = GTF_S
1686616866
return false;
1686716867
}
1686816868

16869-
if (sideEffectFlags == GTF_CALL)
16869+
if ((sideEffectFlags == GTF_CALL) && tree->IsHelperCall())
1687016870
{
16871-
if (tree->IsHelperCall())
16871+
// Generally all trees that contain GT_CALL nodes are considered to have side-effects.
16872+
// However, for some pure helper calls we lie about this.
16873+
if (gtNodeHasSideEffects(tree, flags, ignoreCctors))
1687216874
{
16873-
// Generally all trees that contain GT_CALL nodes are considered to have side-effects.
16874-
// However, for some pure helper calls we lie about this.
16875-
if (gtNodeHasSideEffects(tree, flags, ignoreCctors))
16876-
{
16877-
return true;
16878-
}
16879-
16880-
// The GTF_CALL may be contributed by an operand, so check for
16881-
// that.
16882-
bool hasCallInOperand = false;
16883-
tree->VisitOperands([=, &hasCallInOperand](GenTree* op) {
16884-
if (gtTreeHasSideEffects(op, GTF_CALL, ignoreCctors))
16885-
{
16886-
hasCallInOperand = true;
16887-
return GenTree::VisitResult::Abort;
16888-
}
16889-
return GenTree::VisitResult::Continue;
16890-
});
16891-
16892-
return hasCallInOperand;
16875+
return true;
1689316876
}
16894-
else if (tree->OperIs(GT_INTRINSIC))
16895-
{
16896-
if (gtNodeHasSideEffects(tree, flags, ignoreCctors))
16897-
{
16898-
return true;
16899-
}
16900-
16901-
if (gtNodeHasSideEffects(tree->AsOp()->gtOp1, flags, ignoreCctors))
16902-
{
16903-
return true;
16904-
}
1690516877

16906-
if ((tree->AsOp()->gtOp2 != nullptr) && gtNodeHasSideEffects(tree->AsOp()->gtOp2, flags, ignoreCctors))
16878+
// The GTF_CALL may be contributed by an operand, so check for
16879+
// that.
16880+
bool hasCallInOperand = false;
16881+
tree->VisitOperands([=, &hasCallInOperand](GenTree* op) {
16882+
if (gtTreeHasSideEffects(op, GTF_CALL, ignoreCctors))
1690716883
{
16908-
return true;
16884+
hasCallInOperand = true;
16885+
return GenTree::VisitResult::Abort;
1690916886
}
16887+
return GenTree::VisitResult::Continue;
16888+
});
1691016889

16911-
return false;
16912-
}
16890+
return hasCallInOperand;
1691316891
}
1691416892

1691516893
return true;

0 commit comments

Comments
 (0)