Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emit post-optimization CLIF with --emit-clif #10011

Merged
merged 2 commits into from
Jan 14, 2025

Conversation

alexcrichton
Copy link
Member

This commit updates the implementation of the wasmtime CLI flag --emit-clif to emit the IR post-optimization rather than pre-optimization. This is now emitting the IR that's directly fed to the backend for lowering which reflects any mid-level transformation that's performed. It should still be possible to recover pre-optimized CLIF with -O opt-level=0.

This then additionally refactors functions to emit CLIF in a more "core" location so all trampolines get their CLIF emitted as well in case those are needed for debugging.

This commit updates the implementation of the `wasmtime` CLI flag
`--emit-clif` to emit the IR post-optimization rather than
pre-optimization. This is now emitting the IR that's directly fed to the
backend for lowering which reflects any mid-level transformation that's
performed. It should still be possible to recover pre-optimized CLIF
with `-O opt-level=0`.

This then additionally refactors functions to emit CLIF in a more "core"
location so all trampolines get their CLIF emitted as well in case those
are needed for debugging.
@alexcrichton alexcrichton requested a review from a team as a code owner January 14, 2025 20:32
@alexcrichton alexcrichton requested review from dicej and removed request for a team January 14, 2025 20:32
@alexcrichton
Copy link
Member Author

Looks like all disas tests are changing notably for a few minor differences:

  • Running through the compilation pipeline removes all global_value instructions (replaces them with their equivalents)
  • Unnecessary block params are removed

@alexcrichton alexcrichton added this pull request to the merge queue Jan 14, 2025
Merged via the queue into bytecodealliance:main with commit 21ab8ea Jan 14, 2025
39 checks passed
@alexcrichton alexcrichton deleted the emit-optimized-clif branch January 14, 2025 21:24
alexcrichton added a commit to alexcrichton/wasmtime that referenced this pull request Jan 14, 2025
Just after bytecodealliance#10011 I ran into a case where I wanted to peek at CLIF after
compilation failed but the structure of the code failed to enable this,
so I've refactored `--emit-clif` to emit the CLIF even if the lowering
step fails.
github-merge-queue bot pushed a commit that referenced this pull request Jan 14, 2025
Just after #10011 I ran into a case where I wanted to peek at CLIF after
compilation failed but the structure of the code failed to enable this,
so I've refactored `--emit-clif` to emit the CLIF even if the lowering
step fails.
@bjorn3
Copy link
Contributor

bjorn3 commented Jan 15, 2025

It should still be possible to recover pre-optimized CLIF with -O opt-level=0.

Doesn't that still perform legalizations?

@alexcrichton
Copy link
Member Author

That's true yeah, --emit-clif won't work for that any more

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants