LLVM: Dump Module instead of Function in JIT mode (mono/mono#16837)
Since each function has its own module (in JIT mode) it makes sense to dump the whole module for MONO_VERBOSE_METHOD instead of just LLVM::Function.
It adds metadata, attributes and global variables (so it will be possible to copy-paste it to godbolt)
Example
static int Test(int x)
{
return x / 10;
}
Diff for Unoptimized IR: https://www.diffchecker.com/NrF413Ts
Diff for Optimized IR: https://www.diffchecker.com/jbEkeFFS
So now we can see global variables and metadata for each function (and can easily paste them to godbolt.org)
NOTE: optimized IR for this case contains "dead" variables (dump_module allowed us to see such), we probably need some Module-wide optimizations to strip dead code such as -globaldce
NOTE2: why do we emit exceptions in the first place for this case at all?
Commit migrated from https://github.com/mono/mono/commit/
0438397b8afc51aac45da55c155162e13e83cf19