Skip to content

Commit

Permalink
Use a reverse analysis phase to identify ptradd inlining.
Browse files Browse the repository at this point in the history
In essence, this is the first commit towards moving us to "reverse code
generation by stealth". After JIT IR is optimised, this commit changes
things to a single reverse pass (previously we did a single forward
pass).

During that pass we:

  1. Identify `PtrAdd` instructions which can be inlined by
     `Load`/`Store`.
  2. Implicitly do a second round of dead-code elimination: currently
     this can only DCE some (not all!) `PtrAdd`s (those inlined by ykjit#1
     that aren't used elsewhere).

This turns out to be a much nicer way of optimised `PtrAdd`s than our
previous attempts: the code is neater (though that doesn't mean it's not
involved!) and it's also more effective because the register allocator
now has less things it thinks are alive. Overall, this speeds up
big_loop by about 10% because of the pressure it relieves from the
register allocator.

There is a lot of boring churn in tests because this forces us to
`black_box` lots of tests in the code generator. Honestly, we should
always have done that, but we got with it until now.
  • Loading branch information
ltratt committed Dec 3, 2024
1 parent f28832b commit 1b60da3
Show file tree
Hide file tree
Showing 3 changed files with 331 additions and 183 deletions.
Loading

0 comments on commit 1b60da3

Please sign in to comment.