Skip to content

Simplifier fails with "Simplifier ticks exhausted"

While upgrading a codebase to GHC 8.2.1(it compiles reliably with 7.10.3) we encountered an issue with core simplifier(and rewrite rules if I correctly understood the meaning of RuleFired):

ghc: panic! (the 'impossible' happened)
  (GHC version 8.2.1 for x86_64-apple-darwin):
        Simplifier ticks exhausted
  When trying RuleFired Class op $p2HModify
  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
  Total ticks:     10450410

  1494659 PreInlineUnconditionally
    149100 w_ipsJ
    149095 w_ipps
    149084 w_iplQ
    149084 w1_iplR
    149084 w2_iplS
    149084 w3_iplT
    149078 w_ipm7
    149078 w1_ipm8
    149078 w2_ipm9
    149078 w3_ipma
    120 $d~_iplr
    120 $d~1_ipls
    120 irred_iplu
    120 eta_iplv
    39 v_spsR
    38 v_sp9c
    38 v1_sp9d
    38 v_spii
    38 v1_spij
    38 v2_spik
    38 v3_spil
    37 v_sp99
    37 v1_sp9a
    37 v_spin
    37 v1_spio
    37 v2_spip
    37 v3_spiq
    36 v_sp9f
    36 v1_sp9g
    36 v_spis
...skipping...
    1 cobox1_apuk
    1 cobox_apuq
    1 cobox1_apur
    1 cobox_apux
    1 cobox1_apuy
  2 CaseIdentity 2 ds1_iqAB
  4 FillInCaseDefault
    1 nt_sqyY
    1 nt_sqz9
    1 nt_sqze
    1 nt_sqzj
  Call stack:
      CallStack (from HasCallStack):
        prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1133:58 in ghc:Outputable
        callStackDoc, called at compiler/utils/Outputable.hs:1137:37 in ghc:Outputable
        pprPanic, called at compiler/simplCore/SimplMonad.hs:199:31 in ghc:SimplMonad

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

We tried to shrink reproducible example to something reasonable and this is what we got: https://github.com/4e6/webapp-template-hs/tree/simpl-tick-factor

Compiling it with stack build --ghc-options='-fsimpl-tick-factor=1000'(ten times the default) will demonstrate the issue.

It fails reliably with a combination of servant and hset libraries. Removing one route from a servant API or moving the PayloadX to the head of type-level list makes it compilable again.

Trac metadata
Trac field Value
Version 8.2.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC bgamari
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information