Include source location information in -ddump-rule-rewrites
Inlining is one of the most common and powerful optimizations and it interacts with rewrite-rules which is also common the libraries including base. When debugging a performance problem we are interacting with the rewrite-rules written by others hidden somewhere in some library that we are using. When I use the
-ddump-rule-rewrites option I get an output like this:
Rule fired Rule: Class op >>= Module: (BUILTIN) Before: GHC.Base.>>= TyArg GHC.Types.IO ValArg GHC.Base.$fMonadIO After: GHC.Base.$fMonadIO1
This does not say where exactly this rule is defined in the source. It is sort of ok if this is my code I would perhaps know where this rule is. But when it is in some dependency that I am using it is hard to find.
It will be really helpful if the source location information can be provided in this dump information, so that one can go and examine the source.