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

Code before:
        case GT_INIT_VAL:
            // Always a passthrough of its child's value.
            assert(!"INIT_VAL should always be contained");
            srcCount = 0;
            break;

        case GT_LCLHEAP:
        {
            assert(dstCount == 1);

            // Need a variable number of temp regs (see genLclHeap() in codegenarm64.cpp):
            // Here '-' means don't care.
            //
            //  Size?                   Init Memory?    # temp regs
            //   0                          -               0
            //   const and <=UnrollLimit    -               0
            //   const and <PageSize        No              0
            //   >UnrollLimit               Yes             0
            //   Non-const                  Yes             0
            //   Non-const                  No              2
            //

            GenTree* size        = tree->gtGetOp1();
            bool     clearMemory = compiler->info.compInitMem;

            // When size is a contained constant, it means Lower has took the responsibility to
            // clear the memory.
            if (clearMemory && size->IsCnsIntOrI() && size->isContained())
            {
                clearMemory = false;
            }

            if (size->IsCnsIntOrI())
            {
                assert(size->isContained());
                srcCount = 0;

                size_t sizeVal = size->AsIntCon()->gtIconVal;

                if (sizeVal != 0)
                {
                    // Compute the amount of memory to properly STACK_ALIGN.
                    // Note: The GenTree node is not updated here as it is cheap to recompute stack aligned size.
                    // This should also help in debugging as we can examine the original size specified with
                    // localloc.
                    sizeVal = AlignUp(sizeVal, STACK_ALIGN);

                    if (sizeVal <= compiler->getUnrollThreshold(Compiler::UnrollKind::Memset))
                    {
                        // Need no internal registers
                    }

Review comment (suggestion):
Corrected grammar: 'has took' should be 'has taken'.
```suggestion
            // When size is a contained constant, it means Lower has taken the responsibility to
```

Code after:
        case GT_INIT_VAL:
            // Always a passthrough of its child's value.
            assert(!"INIT_VAL should always be contained");
            srcCount = 0;
            break;

        case GT_LCLHEAP:
        {
            assert(dstCount == 1);

            GenTree* size = tree->gtGetOp1();
            if (size->isContainedIntOrIImmed())
            {
                srcCount = 0;

                // We won't have to clear the memory regardless info.compInitMem is set or not
                // (if it's set, Lower will emit a STORE_BLK for this LCLHEAP), but we still need to
                // do stack-probing for large allocations.
                //
                size_t sizeVal = size->AsIntCon()->gtIconVal;
                if (AlignUp(sizeVal, STACK_ALIGN) >= compiler->eeGetPageSize())
                {
                    // We need two registers: regCnt and RegTmp
                    buildInternalIntRegisterDefForNode(tree);
                    buildInternalIntRegisterDefForNode(tree);
                }
            }
            else
            {
                srcCount = 1;
                if (!compiler->info.compInitMem)
                {
                    buildInternalIntRegisterDefForNode(tree);
                    buildInternalIntRegisterDefForNode(tree);
                }
            }

            if (!size->isContained())
            {
                BuildUse(size);
            }
            buildInternalRegisterUses();
            BuildDef(tree);
        }
        break;

        case GT_BOUNDS_CHECK:
        {
            GenTreeBoundsChk* node = tree->AsBoundsChk();
            // Consumes arrLen & index - has no result
            assert(dstCount == 0);