[GHC] #11195: New pattern-match check can be non-performant

GHC ghc-devs at haskell.org
Sun Dec 27 22:29:22 UTC 2015


#11195: New pattern-match check can be non-performant
-------------------------------------+-------------------------------------
        Reporter:  goldfire          |                Owner:  goldfire
            Type:  bug               |               Status:  new
        Priority:  highest           |            Milestone:  8.0.1
       Component:  Compiler          |              Version:  7.11
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  crash                              |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Ben Gamari <ben@…>):

 In [changeset:"bec5350da09fde51231004b1b7d33641ac51800e/ghc"
 bec5350d/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="bec5350da09fde51231004b1b7d33641ac51800e"
 Adding flags: -ffull-guard-reasoning and too-many-guards

 Introduction of two new flags, for more precise control over the new
 pattern match checker's behaviour when reasoning about guards. This is
 supposed to address #11195 (and maybe more performance bugs related to
 the NP-Hardness of coverage checking).

 Expected behaviour:

   * When `-ffull-guard-reasoning` is on, run the new pattern match
     checker in its full power

   * When `-ffull-guard-reasoning` is off (the default), for every
     match, check a metric to see whether pattern match checking for it
     has high probability of being non performant (at the the moment we
     check whether the number of guards is over 20 but I would like to
     use a more precise measure in the future). If the probability is
     high:

     - Oversimplify the guards (less expressive but more performant)
       and run the checker, and

     - Issue a warning about the simplification that happened.

 A new flag `-Wtoo-many-guards/-Wno-too-many-guards` suppresses the
 warning about the simplification (useful when combined with -Werror).

 Test Plan: validate

 Reviewers: goldfire, austin, hvr, bgamari

 Reviewed By: bgamari

 Subscribers: mpickering, thomie

 Differential Revision: https://phabricator.haskell.org/D1676

 GHC Trac Issues: #11195
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11195#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list