[GHC] #13339: Arbitrarily large expressions built out of cheap primops are not floated out

#13339: Arbitrarily large expressions built out of cheap primops are not floated out -------------------------------------+------------------------------------- Reporter: rwbarton | 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: -------------------------------------+------------------------------------- While investigating #13338 I was tripped up by the fact that GHC won't float out even a large expression like the product in {{{#!hs \i# -> magic# (x# *# 2# *# 2# *# 2# *# 2# *# 2# *# 2# *# 2# *# 2# -# i#) }}} The test involved here is `exprIsCheap`. The fact that `*#` is a cheap primop makes `exprIsCheap` think the whole expression is cheap; but clearly there must come some point where it would be better to float out the expression. Perhaps `exprIsCheap` should work more like `exprIsDupable`, and take the size of the expression into account. See related comments on `primOpIsCheap`, though this ticket is about saving runtime work, not code size. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13339 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13339: Arbitrarily large expressions built out of cheap primops are not floated out -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.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: | -------------------------------------+------------------------------------- Changes (by rwbarton): * version: 8.0.1 => 8.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13339#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13339: Arbitrarily large expressions built out of cheap primops are not floated out -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime | Unknown/Multiple performance bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by rwbarton): * failure: None/Unknown => Runtime performance bug -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13339#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13339: Arbitrarily large expressions built out of cheap primops are not floated out -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime | Unknown/Multiple performance bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by carter): * cc: carter.schonwald@… (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13339#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13339: Arbitrarily large expressions built out of cheap primops are not floated out -------------------------------------+------------------------------------- Reporter: rwbarton | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime | Unknown/Multiple performance bug | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): Yes, taking the size into account would be good. Floating this this out requires boxing it, and doing an eval/unbox inside the loop. When is that cheaper than a dozen in-register additions? I'm not sure. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13339#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC