Skip to content

[wasm] Wasm encoding of reading from array is unnecessarily large #134465

Closed

Description

@davidwrighton

When encoding a load from an array of integers, the codegen is bigger than it needs to be.

What I'm seeing today is

          local.get 6 ;; Load _array from WASM temp
          local.get 4 ;; Load index
          i32.const 2
          i32.shl ;; Scale index * 4
          i32.const 8
          i32.add
          i32.add
          i32.load align=1 ;; Load data from array, with 8 byte offset

What I'd like to see

          local.get 6 ;; Load _array from WASM temp
          local.get 4 ;; Load index
          i32.const 2
          i32.shl ;; Scale index * 4
          i32.add
          i32.load offset=8 align=1 ;; Load data from array, with 8 byte offset

Behavior of these 2 sequences is identical, but the one below is 12 bytes, and the upper one is 15 bytes.

Activity

  1. added
    area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
    arch-wasmWebAssembly architecture
    on Sep 22, 2026
  2. dotnet-policy-service commented on Sep 22, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to 'arch-wasm': @lewing, @pavelsavara
    See info in area-owners.md if you want to be subscribed.

  3. dotnet-policy-service commented on Sep 22, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
    See info in area-owners.md if you want to be subscribed.

  4. self-assigned this
    on Sep 24, 2026
  5. added this to the 12.0.0 milestone on Sep 24, 2026
  6. removed
    untriagedNew issue has not been triaged by the area owner
    on Sep 24, 2026
  7. added a commit that references this issue on Oct 20, 2026
    845ed4c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

arch-wasmWebAssembly architecturearea-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions