[GHC] #8668: SPECIALIZE silently fails to apply

GHC ghc-devs at haskell.org
Wed Dec 7 18:36:36 UTC 2016


#8668: SPECIALIZE silently fails to apply
-------------------------------------+-------------------------------------
        Reporter:  crockeea          |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.8.3
      Resolution:                    |             Keywords:  Inlining
Operating System:  Unknown/Multiple  |         Architecture:  x86_64
 Type of failure:  Runtime           |  (amd64)
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by nfrisby):

 Executive summary: It looks like the expected optimization is achieved in
 GHC 7.10.2. I don't know if something was broken and is now fixed or if
 some other change side-stepped the original problem, etc. etc.

 In GHC 7.10.2, `fcTest` seems to be ''faster'' than `vtTest` (5
 repetitions, using the same `-O3` setting that crockeea used); that's a
 reversal of the originally discussed behavior.

 Compiling `Foo.hs` yields the following rule, which fires when compiling
 `Main.hs`, in spite of the dfuns on the LHS (see #7080).

 {{{
 ------ Local rules for imported ids --------
 "SPEC plusFastCyc" [ALWAYS]
     forall (@ m_a3Ai)
            ($dFactored_a3Aj :: Factored m_a3Ai Int)
            ($dVector_a3Bz :: V.Vector U.Vector Int).
       plusFastCyc @ (VT U.Vector m_a3Ai)
                   @ Int
                   (Foo.$fNumVT
                      @ U.Vector
                      @ m_a3Ai
                      @ Int
                      (GHC.Real.$p1Real
                         @ Int
                         (GHC.Real.$p1Integral
                            @ Int
                            ($dFactored_a3Aj
                             `cast` (Foo.NTCo:Factored[0] <m_a3Ai>_N
 <Int>_N
                                     :: Factored m_a3Ai Int ~R# Integral
 Int))))
                      $dVector_a3Bz
                      $dFactored_a3Aj)
       = Foo.plusFastCyc_$splusFastCyc @ m_a3Ai $dFactored_a3Aj
 }}}

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


More information about the ghc-tickets mailing list