[GHC] #14219: Include source location information in -ddump-rule-rewrites

#14219: Include source location information in -ddump-rule-rewrites -------------------------------------+------------------------------------- Reporter: harendra | Owner: (none) Type: feature | Status: new request | Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 (Debugging) | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Debugging Unknown/Multiple | information is incorrect Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- 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. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14219 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14219: Include source location information in -ddump-rule-rewrites -------------------------------------+------------------------------------- Reporter: harendra | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 (Debugging) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Debugging | Unknown/Multiple information is incorrect | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by harendra): I guess the problem is with GHC builtin rules only. Otherwise the Module name and the rule name will be good enough to identify where the rule is. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14219#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14219: Include source location information in -ddump-rule-rewrites -------------------------------------+------------------------------------- Reporter: harendra | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 (Debugging) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Debugging | Unknown/Multiple information is incorrect | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by harendra): A good way to address this could be to document the BUILTIN rules in the GHC manual. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14219#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14219: Include source location information in -ddump-rule-rewrites -------------------------------------+------------------------------------- Reporter: harendra | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 (Debugging) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Debugging | Unknown/Multiple information is incorrect | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by harendra): Is it feasible/worth it to implement dumping the builtin rules via the `-ddump-rules` option? Then `-ddump-rule-rewrites` output can just refer to the rule-id of the rule dumped via the `-ddump-rules` option. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14219#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14219: Include source location information in -ddump-rule-rewrites -------------------------------------+------------------------------------- Reporter: harendra | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 (Debugging) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Debugging | Unknown/Multiple information is incorrect | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj):
Is it feasible/worth it to implement dumping the builtin rules via the -ddump-rules option?
Sadly built-in rules can do things that are hard to express using ordinary LHS/RHS pairs. Like rewriting `4+5` to `9`. That's why they are implemented in code, not pattern matching. It would be a worthy thing to document all the built-in rules in `PrelRules` in the manual. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14219#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC