Opened 20 months ago

Last modified 5 months ago

#8319 new bug

Simplifier ticks exhausted (need -fsimpl-tick-factor=955)

Reported by: ruudkoot Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.6.3
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Compile-time crash Test Case:
Blocked By: Blocking:
Related Tickets: Differential Revisions:

Description

Attached file needs a rather high simpl-tick-factor (955) in order to compile.

Attachments (1)

Test.hs (2.1 KB) - added by ruudkoot 20 months ago.

Download all attachments as: .zip

Change History (4)

Changed 20 months ago by ruudkoot

comment:1 in reply to: ↑ description Changed 20 months ago by ruudkoot

$ ghc --make -O2 Test.hs

[1 of 1] Compiling Main             ( Test.hs, Test.o )

ghc: panic! (the 'impossible' happened)
  (GHC version 7.6.3 for x86_64-unknown-linux):
	Simplifier ticks exhausted
    When trying UnfoldingDone $w$j{v s3DM} [lid]
    To increase the limit, use -fsimpl-tick-factor=N (default 100)
    If you need to do this, let GHC HQ know, and what factor you needed
    To see detailed counts use -ddump-simpl-stats
    Total ticks: 183945
Last edited 18 months ago by simonpj (previous) (diff)

comment:2 Changed 18 months ago by simonpj

I've found out what is going on. (What follows is an aide-memoire for me.)

There is a huge function of this form:

  f = \x -> let BIG BIG BIG
            in case ... of 
                  p1 -> (# a, b, c, d #)
                  p2 -> (# a, b, c, d #)
                ...
                  p2 -> (# a, b, c, d #)

As things stand, in CoreUnfold, unboxed tuples don't count towards the size of the express, but DO count towards the result discount. See Note [Unboxed tuple size and result discount]. As a result, functions like f can be very big, but have a massive result discount, and hence can be inlined like crazy.

This blows up the size of the test program.

The obvious solution is to nuke the discount, but I need check performance runs carefully. This comment just records my progress.

comment:3 Changed 5 months ago by thomie

This code compiles with ghc-7.8.1, ghc-7.8.3 and ghc-7.9.20141115, using -O2.

Should a regression test be added? Note that the code imports QuickCheck. Without it, the bug is not triggered.

Note: See TracTickets for help on using tickets.