[GHC] #11677: Dramatic de-optimization with "-O", "-O1", "-O2" options

GHC ghc-devs at haskell.org
Sat Mar 5 13:59:11 UTC 2016


#11677: Dramatic de-optimization with "-O", "-O1", "-O2" options
-------------------------------------+-------------------------------------
        Reporter:  malphunction      |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.10.3
      Resolution:                    |             Keywords:  optimization
                                     |  deoptimization
Operating System:  Linux             |         Architecture:  x86_64
 Type of failure:  Runtime           |  (amd64)
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by bgamari):

 For the record, I concluded this by comparing the output of `-ddump-simpl
 -dsuppress-all` from the testcases compiled with `-O1` with and without
 the `evaluate $ deepseq`. The delta in the Core produced in these two
 cases is extremely small,
 {{{#!diff
 @@ -297,6 +302,16 @@
              case $wa @ (String, String) ww1 (lvl3 `cast` ...) ipv4
              of _ { (# ipv6, ipv7 #) ->
              case $sfromList @ [Char] ipv7 of dict' { __DEFAULT ->
 +            case seq#
 +                   @ (Map String String)
 +                   @ RealWorld
 +                   (case $fNFDataMap_$crnf
 +                           @ [Char] @ [Char] ($sforce3 `cast` ...)
 ($sforce3 `cast` ...) dict'
 +                    of _ { () ->
 +                    dict'
 +                    })
 +                   ipv6
 +            of _ { (# ipv8, ipv9 #) ->
              case readEither6 @ Int (run @ Int lvl2 ipv5) of _ {
                [] ->
                  case error
 @@ -306,8 +321,8 @@
                         readEither4
                  of wild3 {
                  };
 -              : x1 ds5 ->
 -                case ds5 of _ {
 +              : x1 ds6 ->
 +                case ds6 of _ {
                    [] ->
                      case x1 of _ { I# ww3 ->
                      case $wa
 @@ -316,25 +331,25 @@
                             ((\ (eta :: State# RealWorld) ->
                                 case wantReadableHandle_1
                                        @ String hGetLine4 stdin (hGetLine2
 `cast` ...) eta
 -                               of _ { (# ipv8, ipv9 #) ->
 -                               (# ipv8, $slookup1 @ [Char] ipv9 dict' #)
 +                               of _ { (# ipv10, ipv11 #) ->
 +                               (# ipv10, $slookup1 @ [Char] ipv11 ipv9 #)
                                 })
                              `cast` ...)
 -                           ipv6
 -                    of _ { (# ipv8, ipv9 #) ->
 +                           ipv8
 +                    of _ { (# ipv10, ipv11 #) ->
                      hPutStr2
                        stdout
 -                      (case $wlenAcc @ [Char] (catMaybes1 @ String ipv9)
 0#
 +                      (case $wlenAcc @ [Char] (catMaybes1 @ String ipv11)
 0#
                         of ww4 { __DEFAULT ->
                         case $wshowSignedInt 0# ww4 ([] @ Char) of _ { (#
 ww6, ww7 #) ->
                         : @ Char ww6 ww7
                         }
                         })
                        True
 -                      ipv8
 +                      ipv10
                      }
                      };
 -                  : ipv8 ipv9 ->
 +                  : ipv10 ipv11 ->
                      case error
                             @ 'PtrRepLifted
                             @ Int
 }}}

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


More information about the ghc-tickets mailing list