binaryen icon indicating copy to clipboard operation
binaryen copied to clipboard

[Strings] Add a string-builtins feature, and lift/lower automatically when enabled

Open kripken opened this issue 6 months ago • 3 comments

This makes string optimizations happen automatically when --enable-string-builtins (or -all).

The lifting/lowering happen globally, at optimal times in the pipeline, so even -O3 -O3 -O3 will only lift once and lower once, avoiding overhead as in #7540 which this replaces.

TODO: document in optimizer cookbook

kripken avatar May 16 '25 00:05 kripken

Hmm, this PR fails many tests because of these TODOs for typed continuations:

https://github.com/WebAssembly/binaryen/blob/f8531ef56e61cb68815c835b294777fbd97f3b0a/src/ir/subtype-exprs.h#L415-L423

This problem becomes noticeable in this PR because we have tests that use -all on continuations code, and now we run StringLowering, which uses SubtypingDiscoverer, so we try to operate on those instructions.

So this PR is blocked on those TODOs.

kripken avatar May 16 '25 14:05 kripken

I can take a look at those TODOs later today, unless you plan on working on them first.

tlively avatar May 16 '25 17:05 tlively

Thanks, I don't think I'd have time today myself.

kripken avatar May 16 '25 17:05 kripken