Skip to content

opt: repair + re-enable the optimized linear-memory path (root-cause the MemLoad ADD-register corruption) #180

@avrabe

Description

@avrabe

Follow-up to #178 (mitigated in PR #179 by declining linear-memory ops to select_with_stack).

What to fix

The optimized ir_to_arm MemLoad/MemStore lowering emits ADD R12, R12, Raddr; LDR Rd, [R12, #offset], but the actual output has the ADD with garbage registers (e.g. adds r4, r5, r1), dropping the address operand — for both dynamic and constant addresses. Root-cause why the hardcoded Reg::R12/r_addr ADD comes out remapped/garbled (a register-allocation or peephole interaction is the prime suspect; note issue_104 store-load tests passed, so some patterns worked — the divergence is a clue).

Done when

Until then, memory-using modules compile correctly but unoptimized (the PR #179 fallback).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions