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

Code before:
    // into the store's address mode. We can utilize a contained LEA, but that will require some liveness work.

    var_types    storeType = lclNode->TypeGet();
    bool         isStruct  = storeType == TYP_STRUCT;
    uint16_t     offset    = lclNode->GetLclOffs();
    ClassLayout* layout    = isStruct ? lclNode->GetLayout(m_compiler) : nullptr;
    lclNode->SetOper(GT_LCL_ADDR);
    lclNode->ChangeType(TYP_I_IMPL);
    lclNode->AsLclFld()->SetLclOffs(offset);

    GenTree*     store;
    GenTreeFlags indFlags = GTF_IND_NONFAULTING | GTF_IND_TGT_NOT_HEAP;
    if (isStruct)
    {
        store = m_compiler->gtNewStoreBlkNode(layout, lclNode, value, indFlags);
    }
    else
    {
        store = m_compiler->gtNewStoreIndNode(storeType, lclNode, value, indFlags);
    }
    CurrentRange().InsertAfter(lclNode, store);
    CurrentRange().Remove(lclNode);
    CurrentRange().InsertBefore(insertionPoint, lclNode);

    auto tempRange = LIR::ReadOnlyRange(store, store);
    m_compiler->m_pLowering->LowerRange(m_currentBlock, tempRange);
}

//------------------------------------------------------------------------
// CollectReference: Add 'node' to the candidate reference list.
//
// To be later assigned a physical register.
//
// Arguments:
//    node - The node to collect
//
void WasmRegAlloc::CollectReference(GenTree* node)
{
    VirtualRegReferences* refs = m_virtualRegRefs;
    if (refs == nullptr)
    {
        refs             = new (m_compiler->getAllocator(CMK_LSRA_RefPosition)) VirtualRegReferences();
        m_virtualRegRefs = refs;
    }
    else if (m_lastVirtualRegRefsCount == ARRAY_SIZE(refs->Nodes))
    {
        refs                      = new (m_compiler->getAllocator(CMK_LSRA_RefPosition)) VirtualRegReferences();
        refs->Prev                = m_virtualRegRefs;
        m_virtualRegRefs          = refs;
        m_lastVirtualRegRefsCount = 0;
    }

Review comment (suggestion):
```suggestion
    LIR::ReadOnlyRange storeRange(store, store);
    m_compiler->m_pLowering->LowerRange(m_currentBlock, storeRange);
```
We generally like to avoid `auto`.

Code after:
    // into the store's address mode. We can utilize a contained LEA, but that will require some liveness work.

    var_types    storeType = lclNode->TypeGet();
    bool         isStruct  = storeType == TYP_STRUCT;
    uint16_t     offset    = lclNode->GetLclOffs();
    ClassLayout* layout    = isStruct ? lclNode->GetLayout(m_compiler) : nullptr;
    lclNode->SetOper(GT_LCL_ADDR);
    lclNode->ChangeType(TYP_I_IMPL);
    lclNode->AsLclFld()->SetLclOffs(offset);

    GenTree*     store;
    GenTreeFlags indFlags = GTF_IND_NONFAULTING | GTF_IND_TGT_NOT_HEAP;
    if (isStruct)
    {
        store = m_compiler->gtNewStoreBlkNode(layout, lclNode, value, indFlags);
    }
    else
    {
        store = m_compiler->gtNewStoreIndNode(storeType, lclNode, value, indFlags);
    }
    CurrentRange().InsertAfter(lclNode, store);
    CurrentRange().Remove(lclNode);
    CurrentRange().InsertBefore(insertionPoint, lclNode);

    LIR::ReadOnlyRange storeRange(store, store);
    m_compiler->GetLowering()->LowerRange(m_currentBlock, storeRange);
}

//------------------------------------------------------------------------
// CollectReference: Add 'node' to the candidate reference list.
//
// To be later assigned a physical register.
//
// Arguments:
//    node - The node to collect
//
void WasmRegAlloc::CollectReference(GenTree* node)
{
    VirtualRegReferences* refs = m_virtualRegRefs;
    if (refs == nullptr)
    {
        refs             = new (m_compiler->getAllocator(CMK_LSRA_RefPosition)) VirtualRegReferences();
        m_virtualRegRefs = refs;
    }
    else if (m_lastVirtualRegRefsCount == ARRAY_SIZE(refs->Nodes))
    {
        refs                      = new (m_compiler->getAllocator(CMK_LSRA_RefPosition)) VirtualRegReferences();
        refs->Prev                = m_virtualRegRefs;
        m_virtualRegRefs          = refs;
        m_lastVirtualRegRefsCount = 0;
    }