[GHC] #15573: Make bindings with multiple occurrences a join point instead of duplicating code during inlining.

#15573: Make bindings with multiple occurrences a join point instead of duplicating
code during inlining.
-------------------------------------+-------------------------------------
Reporter: AndreasK | Owner: (none)
Type: task | Status: new
Priority: normal | Milestone: 8.6.1
Component: Compiler | Version: 8.4.3
Keywords: JoinPoints | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
I have some intermediate core of the form:
{{{
-- RHS size: {terms: 9, types: 2, coercions: 0, joins: 0/0}
cseAlts_s1dD [Occ=Once!T[1]] :: T -> Int#
[LclId, CallArity=1, Str=]
cseAlts_s1dD
= \ (lamVar_s1dw [Occ=Once!, Dmd=, OS=OneShot] :: T) ->
case lamVar_s1dw of wild_Xc [Dmd=] :: T)
(w_s1cV [Occ=Once*, Dmd=

#15573: Make bindings with multiple occurrences a join point instead of duplicating code during inlining. -------------------------------------+------------------------------------- Reporter: AndreasK | Owner: (none) Type: task | Status: new Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.4.3 Resolution: | Keywords: JoinPoints 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 simonpj): This relates to #15560: in the current ticket you are proposing the to use float-in (the opposite of float-out) to make `cseAlts_s1dD` a local binging again. I'd prefer instead to make the top-level version (in the Description) more efficient so that it's just as efficient as the join-point version. One reason I want to do that is because it improves inlining opportunities, by making the function (`fmerge` in this case) smaller. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15573#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15573: Make bindings with multiple occurrences a join point instead of duplicating code during inlining. -------------------------------------+------------------------------------- Reporter: AndreasK | Owner: (none) Type: task | Status: new Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.4.3 Resolution: | Keywords: JoinPoints Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #15560 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by AndreasK): * related: => #15560 Comment: Replying to [comment:1 simonpj]:
This relates to #15560: in the current ticket you are proposing the to use float-in (the opposite of float-out) to make `cseAlts_s1dD` a local binging again.
I'd prefer instead to make the top-level version (in the Description) more efficient so that it's just as efficient as the join-point version.
While we can (and should!) improve on the current cost even with your suggestions there will likely still be an overhead caused by code layout and calling convention. Even if far smaller.
One reason I want to do that is because it improves inlining opportunities, by making the function (`fmerge` in this case) smaller.
Indeed this sounds good. However I'm not sure if we can make calling top level functions efficient enough to **never** warant inlining. And assuming we still end up inlining in some cases this optimization would be good to have. But I agree that the ideas discussed in #15560 have the chance to remove the need for this. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15573#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC