effekt icon indicating copy to clipboard operation
effekt copied to clipboard

Every phase ought to have textual output for debugging

Open jiribenes opened this issue 1 year ago • 2 comments

As far as I can tell, currently --ir-write-all prints:

  • core (optimized or not depends on an optimization toggle)
  • target
  • machine (if relevant for the given target)

I'd like a much more fine-grained solution. For many bugs, it would be much easier if we could print the current state before/after every phase like:

  • before/after Polymorphism Boxing
  • before/after individual optimization/normalization passes
  • before/after CPS on JS backend
  • before all core optimizations and after all core optimizations
  • etc

My goal is to be able to call some --ir-write-all-yes-really and get 382 files (one for each nanopass) I can binary search through in order to determine what went wrong in which phase, without needing to modify the compiler, sparkling debug prints everywhere. An example is #934 — I think I know where the issue is, but I really don't want to ad hoc trace the whole JS backend code...

jiribenes avatar Apr 14 '25 18:04 jiribenes

Related to (or duplicate of) #573

marvinborner avatar Apr 14 '25 18:04 marvinborner

Ha, I thought we had an issue for it, but I couldn't find it, thanks for linking! In a way, it is a duplicate — I think my issue is more of a manifesto about how things ought to be — but I still want to talk about it at the weekly meeting :)

jiribenes avatar Apr 14 '25 18:04 jiribenes