Skip to content
This repository was archived by the owner on Jun 26, 2020. It is now read-only.

[codegen] Fold uextend.i64.i32 into a no-op whenever possible on x86#845

Closed
bnjbvr wants to merge 1 commit into
bytecodealliance:masterfrom
bnjbvr:remove-redundant-move
Closed

[codegen] Fold uextend.i64.i32 into a no-op whenever possible on x86#845
bnjbvr wants to merge 1 commit into
bytecodealliance:masterfrom
bnjbvr:remove-redundant-move

Conversation

@bnjbvr

@bnjbvr bnjbvr commented Jul 12, 2019

Copy link
Copy Markdown
Member

Still a WIP. This removes spurious moves (generated by uextend.i64.i32) whenever the previous instruction did zero the upper 32 bits for us.

Remaining things to do:

  • Fix constraints of the null recipe being not satisfied.
  • Make a whitelist of (instruction, encodings) that are acceptable, so it handles most of the cases where this optimization is useful.
  • Once Improve extractlane and replacelane on x86 #943 is merged, add back the uextend in the wasm generation of ExtractLaneU, and fold it back in this new peephole optimization pass.

@lars-t-hansen

Copy link
Copy Markdown
Collaborator

This is a fine stopgap solution. In general however we want something table-driven (ie a machine-generated automaton) that runs during machine code generation and acts on the actual encodings emitted. Such an automaton can likely subsume other optimizations, eg the shrinking pass.

@bnjbvr

bnjbvr commented Sep 30, 2019

Copy link
Copy Markdown
Member Author

I'll need to re-work this a bit, and think about it (maybe publicly as part of an issue). Closing since there are no good reasons to keep this WIP PR open for too long.

@bnjbvr bnjbvr closed this Sep 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants