Skip to content

Inlining changes behavior of memory load #13538

Description

@alexcrichton

This input:

(component
  (core module $M
    (memory (export "mem") 1)
    (func (export "writeit") (param i32 i32)
      (i32.store (local.get 0) (local.get 1)))
  )
  (core instance $m (instantiate $M))
  (core module $N
    (import "" "mem" (memory 1))
    (import "" "writeit" (func $writeit (param i32 i32)))
    (func (export "g") (result i32)
      (i32.load (i32.const 0))
      drop
      (call $writeit (i32.const 0) (i32.const 123))
      (i32.load (i32.const 0)))
  )
  (core instance $n (instantiate $N
      (with "" (instance
        (export "mem" (memory $m "mem"))
        (export "writeit" (func $m "writeit"))))))
  (func (export "g") (result u32) (canon lift (core func $n "g"))))

changes behavior with inlining:

$ cargo run -- -C inlining=n --invoke 'g()' repro.wat
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.15s
     Running `/home/alex/code/wasmtime2/target/debug/wasmtime -C inlining=n --invoke 'g()' repro.wat`
123
$ cargo run -- -C inlining=y --invoke 'g()' repro.wat
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.11s
     Running `/home/alex/code/wasmtime2/target/debug/wasmtime -C inlining=y --invoke 'g()' repro.wat`
0

An LLM-produced report is here and this looks like a regression after #13525 and #13354 -- cc @fitzgen

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions