I'm currently hitting a bug in regalloc2, but don't have an easy way to share the regalloc input. What are your thoughts about having a regalloc2-tool
which reads a textual representation of a Function
and MachineEnv
and run the register allocator and checker on it. A utility function would also be provided to serialize a Function
and MachineEnv
into this textual representation.
This would be useful both for debugging and for working on better optimizations in the register allocator.
Yes, that would be very useful indeed! Possibly if what we need is a way to snapshot bug-cases, we could get away with something simpler as well, e.g. a bincode
format (regalloc.rs had this)
although a text format has nice long-term value: it would allow us to reify a fuzz corpus into a regression suite in-tree; currently the fuzzer is really good for testing but each person has to independently build up a corpus
(that's a problem that can also be solved by keeping a corpus repo I guess, but having the ability to read and write human-readable test cases and minimize by hand would be nice)
I've found that, in practice, corpus repos become out of date almost immediately unless there is automation to keep them up to date
also, they aren't incredibly useful for arbitrary
-based fuzz targets, because if the Arbitrary
types change, then the fuzz inputs tend not to test what they did before anymore
Here's the output of regalloc2-tool for the function that I'm currently debugging: https://gist.github.com/Amanieu/b1a338a5b2da38355f60b0f5fe5eb79c
I ended up just using bincode for serialization instead of a text format for simplicity.
Last updated: Nov 22 2024 at 17:03 UTC