Repository: dotnet/runtime
File: src/coreclr/jit/lower.cpp (C++)

Code before:
// ContainCheckLclHeap: determine whether the source of a GT_LCLHEAP node should be contained.
//
// Arguments:
//    node - pointer to the node
//
void Lowering::ContainCheckLclHeap(GenTreeOp* node)
{
    assert(node->OperIs(GT_LCLHEAP));
    GenTree* size = node->gtOp1;
    if (size->IsCnsIntOrI())
    {
        MakeSrcContained(node, size);
    }
}

//------------------------------------------------------------------------
// ContainCheckRet: determine whether the source of a node should be contained.
//
// Arguments:
//    node - pointer to the node
//
void Lowering::ContainCheckRet(GenTreeUnOp* ret)
{
    assert(ret->OperIs(GT_RETURN, GT_SWIFT_ERROR_RET));

#if !defined(TARGET_64BIT) && !defined(TARGET_WASM)
    if (ret->TypeIs(TYP_LONG))
    {
        GenTree* op1 = ret->AsOp()->GetReturnValue();
        noway_assert(op1->OperIs(GT_LONG));
        MakeSrcContained(ret, op1);
    }
#endif // !defined(TARGET_64BIT) && !defined(TARGET_WASM)
#if FEATURE_MULTIREG_RET
    if (ret->TypeIs(TYP_STRUCT))
    {
        GenTree* op1 = ret->AsOp()->GetReturnValue();
        // op1 must be either a lclvar or a multi-reg returning call
        if (op1->OperIs(GT_LCL_VAR))
        {
            const LclVarDsc* varDsc = comp->lvaGetDesc(op1->AsLclVarCommon());
            // This must be a multi-reg return or an HFA of a single element.
            assert(varDsc->lvIsMultiRegRet);

            // Mark var as contained if not enregisterable.
            if (!varDsc->IsEnregisterableLcl())
            {
                if (!op1->IsMultiRegLclVar())
                {
                    MakeSrcContained(ret, op1);
                }

Review comment (refactor):
```suggestion
#if LOWER_DECOMPOSE_LONGS
```
(And adjust the ifdef comment below)

> Might want to remove GT_LONG entirely from wasm builds.

`GT_LONG` could be put under the same `#if`, yeah. Though it is not strictly necessary.

Code after:
// ContainCheckLclHeap: determine whether the source of a GT_LCLHEAP node should be contained.
//
// Arguments:
//    node - pointer to the node
//
void Lowering::ContainCheckLclHeap(GenTreeOp* node)
{
    assert(node->OperIs(GT_LCLHEAP));
    GenTree* size = node->gtOp1;
    if (size->IsCnsIntOrI())
    {
        MakeSrcContained(node, size);
    }
}

//------------------------------------------------------------------------
// ContainCheckRet: determine whether the source of a node should be contained.
//
// Arguments:
//    node - pointer to the node
//
void Lowering::ContainCheckRet(GenTreeUnOp* ret)
{
    assert(ret->OperIs(GT_RETURN, GT_SWIFT_ERROR_RET));

#if LOWER_DECOMPOSE_LONGS
    if (ret->TypeIs(TYP_LONG))
    {
        GenTree* op1 = ret->AsOp()->GetReturnValue();
        noway_assert(op1->OperIs(GT_LONG));
        MakeSrcContained(ret, op1);
    }
#endif // LOWER_DECOMPOSE_LONGS
#if FEATURE_MULTIREG_RET
    if (ret->TypeIs(TYP_STRUCT))
    {
        GenTree* op1 = ret->AsOp()->GetReturnValue();
        // op1 must be either a lclvar or a multi-reg returning call
        if (op1->OperIs(GT_LCL_VAR))
        {
            const LclVarDsc* varDsc = comp->lvaGetDesc(op1->AsLclVarCommon());
            // This must be a multi-reg return or an HFA of a single element.
            assert(varDsc->lvIsMultiRegRet);

            // Mark var as contained if not enregisterable.
            if (!varDsc->IsEnregisterableLcl())
            {
                if (!op1->IsMultiRegLclVar())
                {
                    MakeSrcContained(ret, op1);
                }