Opened 10 months ago

Last modified 7 months ago

#15960 new bug

Using -g causes differences in generated core.

Reported by: AndreasK Owned by:
Priority: normal Milestone:
Component: Compiler Version: 8.6.2
Keywords: DWARF Cc: nh2, Fuuzetsu
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

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.

Change History (9)

comment:1 Changed 10 months ago 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?

comment:2 in reply to:  1 Changed 10 months ago 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.

comment:3 Changed 10 months ago by carter

Agreed, -gN flags are supposed to never change the core. This is a bug

comment:4 Changed 10 months ago 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?

comment:5 Changed 9 months ago by bgamari

Milestone: 8.6.3

Ticket retargeted after milestone closed

comment:6 Changed 9 months ago by nh2

Cc: nh2 added

comment:7 Changed 9 months ago by Fuuzetsu

Cc: Fuuzetsu added

comment:8 Changed 7 months ago by bgamari

Keywords: DWARF added

comment:9 Changed 7 months ago 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.

Note: See TracTickets for help on using tickets.