Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JIT] Optimize multiple loads to a COPY
In the tiling process, it is possible that a single LOAD node that is referenced by multiple nodes will be evaluated twice, because the tiling process assigns a tile with an implicit load. The COPY node is opaque to tiling and semantically equivalent, so it can be used to 'force' a value into a register if it has multiple referents. We can probably improve on that if we can prove that we will (probably) spill that value so that reifying it via COPY is a net loss. This uncovered an ordering bug in the sp_p6obind_o and sp_p6obind_s templates, in that the ^write_barrier macro will evaluate its second argument conditionally; if that second argument is then used in the consequent block it might not be available. This is a bug in the template and the only way we got away with it before now is that the use in ^write_barrier folds the entire (load) subtree into a (nz) node, thereby avoiding to evaluate the (load) node itself into a separate value. Adding a (discard) which also orders the load resolves the issue for now, but I'm thinking about more comprehensive solution.
- Loading branch information
Showing
1 changed file
with
48 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters