Improve LLVM IR dumps

Hi all,

I have been thinking about an improvement to -print-(before/after)-all feature. In some situations you want to check how code changes between different passes. This is already available in GCC using -fdump-tree-cfg. It would be great to have a similar way of dumping code in LLVM, possibly with Godbolt integration that makes it able to watch the differences.

The way how it is available now is nice, but quite inconvenient, so the idea is to:

1) Dump IR from each pass to separate file.
2) Make dumps complete. For now, dumps from some passes are partial, e. g. they contain only loop body.
3) Integrate with Godbolt.

Why to do this?
It helps to debug optimizations and other passes that change IR. It also makes compiler easier to be understood.

Your comments are greatly appreciated. What do you think about utility of the improvement?

Cheers,
Damian

Hi all,

I have been thinking about an improvement to -print-(before/after)-all feature. In some situations you want to check how code changes between different passes. This is already available in GCC using -fdump-tree-cfg. It would be great to have a similar way of dumping code in LLVM, possibly with Godbolt integration that makes it able to watch the differences.

The way how it is available now is nice, but quite inconvenient, so the idea is to:

1) Dump IR from each pass to separate file.
2) Make dumps complete. For now, dumps from some passes are partial, e. g. they contain only loop body.

Already available with -print-module-scope (and -print-after-all).

3) Integrate with Godbolt.

Why to do this?
It helps to debug optimizations and other passes that change IR. It also makes compiler easier to be understood.

Your comments are greatly appreciated. What do you think about utility of the improvement?

There was a relatively recent patch by Alexandre Isoard on -git-commit-after-all (not accepted/integrated):
⚙ D44244 [LLVM] Add -git-commit-after-all option

As was discussed earlier on the list, implementation for it should be closer to what you describe here.
However I still sometimes find this patch rather useful as it is.

regards,
Fedor.