Hi,
As discussed in this thread on the mailing list http://lists.llvm.org/pipermail/llvm-dev/2018-April/122785.html, here's my attempt to implement a debugify-each mode and to create a DebugifyFunctionPass.
If you are ok with this approach, I will implement a DebugifyBasicBlockPass, a DebugifyLoopPass and a DebugifyRegionPass likewise.
Another TODO is to make debugify-each as well as Debugify passes other than DebugifyModulePass work with the new Pass Manager, but this is not necessary for the GSoC (-O1/2/3/s/z optimization pipelines are handled by the LegacyPassManager). But I am willing to tackle it if you do not have anything against.
This is my first major patch, so please forgive me if I've done anything wrong...
Thank you all for your help