diff --git a/src/coreclr/jit/compiler.hpp b/src/coreclr/jit/compiler.hpp index ff316205567597..31549281257cf2 100644 --- a/src/coreclr/jit/compiler.hpp +++ b/src/coreclr/jit/compiler.hpp @@ -1849,7 +1849,7 @@ inline GenTree* Compiler::gtNewNothingNode() inline bool GenTree::IsNothingNode() const { - return OperIs(GT_NOP) && TypeIs(TYP_VOID); + return OperIs(GT_NOP); } /***************************************************************************** diff --git a/src/coreclr/jit/gentree.cpp b/src/coreclr/jit/gentree.cpp index f09808f88d6f56..628827b1133b64 100644 --- a/src/coreclr/jit/gentree.cpp +++ b/src/coreclr/jit/gentree.cpp @@ -20412,21 +20412,7 @@ bool GenTree::canBeContained() const bool GenTree::isContained() const { assert(OperIsLIR()); - const bool isMarkedContained = ((gtFlags & GTF_CONTAINED) != 0); - -#ifdef DEBUG - if (!canBeContained()) - { - assert(!isMarkedContained); - } - - // if it's contained it can't be unused. - if (isMarkedContained) - { - assert(!IsUnusedValue()); - } -#endif // DEBUG - return isMarkedContained; + return (gtFlags & GTF_CONTAINED) != 0; } // return true if node is contained and an indir diff --git a/src/coreclr/jit/gentree.h b/src/coreclr/jit/gentree.h index 7033e6cb81cd42..5162269c33766a 100644 --- a/src/coreclr/jit/gentree.h +++ b/src/coreclr/jit/gentree.h @@ -1939,12 +1939,6 @@ struct GenTree bool OperIsLIR() const { - if (OperIs(GT_NOP)) - { - // NOPs may only be present in LIR if they do not produce a value. - return IsNothingNode(); - } - return (DebugOperKind() & DBK_NOTLIR) == 0; } diff --git a/src/coreclr/jit/lir.cpp b/src/coreclr/jit/lir.cpp index 9fd2a8fce62988..da1a6ff5f5f41e 100644 --- a/src/coreclr/jit/lir.cpp +++ b/src/coreclr/jit/lir.cpp @@ -1630,6 +1630,12 @@ bool LIR::Range::CheckLIR(Compiler* compiler, bool checkUnusedValues) const // Verify that the node is allowed in LIR. assert(node->OperIsLIR()); + if (node->isContained()) + { + assert(node->canBeContained()); + assert(!node->IsUnusedValue()); + } + // Some nodes should never be marked unused, as they must be contained in the backend. // These may be marked as unused during dead code elimination traversal, but they *must* be subsequently // removed.