[GHC] #13317: exprIsConApp_maybe should deal better with strings
#13317: exprIsConApp_maybe should deal better with strings -------------------------------------+------------------------------------- Reporter: simonpj | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Consider {{{ x :: Addr# x = "foo"# y = case unpackCString# x of [] -> ... (x:xs) -> ... }}} `exprIsConApp_maybe` has a special case for literal strings; see `Note [exprIsConApp_maybe on literal strings]` in `CoreSubst`. But it only works if `unpackCString#` is applied to a literal, not to a variable bound to a literal (like `x`). The fix is easy. Instead of this code {{{ , [Lit (MachStr str)] <- args = dealWithStringLiteral fun str co }}} we want to use `exprIsLiteral_maybe`, thus {{{ , Just (MachStr str) <- exprIsLiteral_maybe ... arg = dealWithStringLiteral fun str co }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13317> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13317: exprIsConApp_maybe should deal better with strings -------------------------------------+------------------------------------- Reporter: simonpj | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Simon Peyton Jones <simonpj@…>): In [changeset:"a6e13d502ef46de854ec1babcd764ccce68c95e3/ghc" a6e13d50/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="a6e13d502ef46de854ec1babcd764ccce68c95e3" Make exprIsConApp_maybe work better for literals strings There are two things here * Use exprIsLiteral_maybe to "look through" a variable bound to a literal string. * Add CONLIKE to the NOINLINE pragma for unpackCString# and unpackCStringUtf8# See Trac #13317, Trac #10844, and Note [exprIsConApp_maybe on literal strings] in CoreSubst I did a nofib run and got essentially zero change except for one 2.2% improvement in allocation for 'pretty'. }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13317#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13317: exprIsConApp_maybe should deal better with strings -------------------------------------+------------------------------------- Reporter: simonpj | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | simplCore/should_compile/T13317 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * status: new => closed * testcase: => simplCore/should_compile/T13317 * resolution: => fixed -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13317#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13317: exprIsConApp_maybe should deal better with strings -------------------------------------+------------------------------------- Reporter: simonpj | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: fixed | Keywords: strings Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | simplCore/should_compile/T13317 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * keywords: => strings -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13317#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC