Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Format "Load/Store + PtrAdd" more carefully.
This commit does two things which might not seem immediately related: 1. It only prints out instructions which aren't tombstones are equivalent. 2. It formats loads/store that inline ptradds as `load %x + y` and `*(%x + y) = z` respectively. In essence, before this commit we printed out all the "not used" `PtrAdd` instructions, which meant that one got things like: ``` ; %2: ... ... ; %3: ptr = ptr_add %2, 4 ; %4: i8 = load %3 mov ... ``` In other words, such `PtrAdd`s didn't generate machine code. That's fine but it turns out that we also printed some non-`PtrAdd`-but-dead instructions too that the x64 backend's DCE had worked out. That's actively misleading: it meant that some optimisations could be misread as not being as effective as expected, because they would appear in `jit-post-opt` even though they didn't generate code. Step #2 above changes the formatting so that the example above is now shown as the following in `jit-asm` output: ``` ; %2: ... ... ; %4: i8 = load %2 + 4 mov ... ``` This means that the x64 backend produces JIT IR that isn't exactly parseable -- at least not right now. It's also different than `jit-post-opt`. This initially felt a bit surprising to me, but then I realised that `jit-asm` really means "backend specific output" and suddenly it made more sense to me. The x64 backend *is* manipulating the trace IR in a way that lets it generate better code and once upon a time I briefly considered giving it a new IR before realising that I could repurpose the trace IR. So if one views the `jit-asm` output as "another IR that happens to mostly look the same as trace IR" it all makes sense -- at least to me!
- Loading branch information