[GHC] #15960: Using -g causes differences in generated core.

#15960: Using -g causes differences in generated core. -------------------------------------+------------------------------------- Reporter: AndreasK | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.3 Component: Compiler | Version: 8.6.2 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- For nofib/shootout/fannkuch-redux: Normal results {{{
/e/ghc-8.6.1/bin/ghc.exe Main.hs -O2 -XBangPatterns -fforce-recomp -ddump-simpl -dsuppress-all -dsuppress-uniques | less ... Result size of Tidy Core = {terms: 2,747, types: 2,736, coercions: 100, joins: 50/73} ... }}}
{{{
/e/ghc-8.6.1/bin/ghc.exe Main.hs -O2 -XBangPatterns -fforce-recomp -ddump-simpl -dsuppress-all -dsuppress-uniques -g | less ... Result size of Tidy Core = {terms: 2,654, types: 2,557, coercions: 100, joins: 38/71} ... }}}
There are also structural differences in the generated code. I've hit the issue with a tree based on head as well so likely happening there as well. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15960 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15960: Using -g causes differences in generated core. -------------------------------------+------------------------------------- Reporter: AndreasK | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.3 Component: Compiler | Version: 8.6.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by osa1): I think this is because `CorePrep` adds ticks in data con workers. Comments around the code: {{{ -- If we want to generate debug info, we put a source note on the -- worker. This is useful, especially for heap profiling. }}} Why do you think this is a bug? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15960#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15960: Using -g causes differences in generated core. -------------------------------------+------------------------------------- Reporter: AndreasK | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.3 Component: Compiler | Version: 8.6.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by AndreasK): It directly contradicts the info on the wiki:
It is important to realize that - in contrast to instrumentation - adding DWARF debug information does not change the code sections of the executable.
In particular some expressions get turned into join points without -g, but are inlined without -g. This leads to different code being generated and ultimately also to different behaviour in regards to performance. It seems reasonably that it is caused by the adding of source notes you mentioned. But if source notes cause different inlining/join point behaviour I would still consider that a bug. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15960#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15960: Using -g causes differences in generated core. -------------------------------------+------------------------------------- Reporter: AndreasK | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.3 Component: Compiler | Version: 8.6.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by carter): Agreed, -gN flags are supposed to never change the core. This is a bug -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15960#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15960: Using -g causes differences in generated core. -------------------------------------+------------------------------------- Reporter: AndreasK | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.3 Component: Compiler | Version: 8.6.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by carter): The gating / phab stuff on originally adding -g flags / getting them merged in was that core was to never be impacted. Was this change added after the initial merge or was it explicitly accepted? And or what core equivalencies are in the test suite for -g? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15960#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15960: Using -g causes differences in generated core. -------------------------------------+------------------------------------- Reporter: AndreasK | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by nh2): * cc: nh2 (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15960#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15960: Using -g causes differences in generated core. -------------------------------------+------------------------------------- Reporter: AndreasK | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by Fuuzetsu): * cc: Fuuzetsu (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15960#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15960: Using -g causes differences in generated core. -------------------------------------+------------------------------------- Reporter: AndreasK | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.2 Resolution: | Keywords: DWARF Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * keywords: => DWARF -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15960#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15960: Using -g causes differences in generated core. -------------------------------------+------------------------------------- Reporter: AndreasK | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.2 Resolution: | Keywords: DWARF Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by bgamari): For what it's worth I also saw several validation issues when enabling the DWARF CI rule. I believe at least some of them are due to a PrelRule note firing due to the presence of a source tick. I'm not sure if this covers all of the failures, however. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15960#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC