[GHC] #7796: improve dead code elimination in CorePrep

#7796: improve dead code elimination in CorePrep -----------------------------+---------------------------------------------- Reporter: nfrisby | Owner: nfrisby Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.6.2 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Blockedby: Blocking: | Related: #4962 #5433 -----------------------------+---------------------------------------------- #4962 is about generating code for (and allocating at runtime!) bindings that are kept alive only by RULEs even though the RULEs are useless downstream of .hi file generation. Simon Marlow's patch for #5433 switched to a custom dead code eliminator, since the "(case) binder swap" in OccurAnal was creating breaking some code generator invariants. However, that custom dead code generator doesn't do a dependency analysis, so a letrec like this {{{ let f = [g] \r [...] -> ... g = [g] \r [...] -> ... in ... g ... }}} is sent to the code generator ''without dropping'' `f`. A patch to use a dependency analysis in CorePrep's dead code eliminator improves allocation for several nofib programs (largest: cryptarithm2, knights, fem). {{{ Min -0.0% -4.2% -7.7% -7.7% -5.9% Max +0.0% +0.0% +4.3% +4.3% +14.3% Geometric Mean -0.0% -0.1% -0.2% -0.2% +0.2% }}} -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7796 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7796: improve dead code elimination in CorePrep -----------------------------+---------------------------------------------- Reporter: nfrisby | Owner: nfrisby Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.6.2 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Blockedby: Blocking: | Related: #4962 #5433 -----------------------------+---------------------------------------------- Comment(by nfrisby): SPJ suggested it'd be simpler to parameterize the occurrence analyser to disable the binder swap. I'm validating that patch now. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7796#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7796: improve dead code elimination in CorePrep
-----------------------------+----------------------------------------------
Reporter: nfrisby | Owner: nfrisby
Type: bug | Status: new
Priority: normal | Component: Compiler
Version: 7.6.2 | Keywords:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
Failure: None/Unknown | Blockedby:
Blocking: | Related: #4962 #5433
-----------------------------+----------------------------------------------
Comment(by nicolas.frisby@…):
commit c7d80c6524390551b64e9c1d651e1a03ed3c7617
{{{
Author: Nicolas Frisby

#7796: improve dead code elimination in CorePrep ---------------------------------+------------------------------------------ Reporter: nfrisby | Owner: nfrisby Type: bug | Status: closed Priority: normal | Component: Compiler Version: 7.6.2 | Resolution: fixed Keywords: | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: None/Unknown Blockedby: | Blocking: Related: #4962 #5433 | ---------------------------------+------------------------------------------ Changes (by nfrisby): * status: new => closed * resolution: => fixed Comment: I added the test case simplCore/should_compile/T7796 to test for this. For whatever reason, my "Test Case:" box on this form is greyed out... harumph. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7796#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7796: improve dead code elimination in CorePrep ---------------------------------------------+------------------------------ Reporter: nfrisby | Owner: nfrisby Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.6.2 Resolution: fixed | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Difficulty: Unknown Testcase: simplCore/should_compile/T7796 | Blockedby: Blocking: | Related: #4962 #5433 ---------------------------------------------+------------------------------ Changes (by simonpj): * testcase: => simplCore/should_compile/T7796 * difficulty: => Unknown Old description:
#4962 is about generating code for (and allocating at runtime!) bindings that are kept alive only by RULEs even though the RULEs are useless downstream of .hi file generation.
Simon Marlow's patch for #5433 switched to a custom dead code eliminator, since the "(case) binder swap" in OccurAnal was creating breaking some code generator invariants.
However, that custom dead code generator doesn't do a dependency analysis, so a letrec like this
{{{ let f = [g] \r [...] -> ... g = [g] \r [...] -> ... in ... g ... }}}
is sent to the code generator ''without dropping'' `f`.
A patch to use a dependency analysis in CorePrep's dead code eliminator improves allocation for several nofib programs (largest: cryptarithm2, knights, fem).
{{{ Min -0.0% -4.2% -7.7% -7.7% -5.9% Max +0.0% +0.0% +4.3% +4.3% +14.3% Geometric Mean -0.0% -0.1% -0.2% -0.2% +0.2% }}}
New description: #4962 is about generating code for (and allocating at runtime!) bindings that are kept alive only by RULEs even though the RULEs are useless downstream of .hi file generation. Simon Marlow's patch for #5433 switched to a custom dead code eliminator, since the "(case) binder swap" in !OccurAnal was creating breaking some code generator invariants. However, that custom dead code generator doesn't do a dependency analysis, so a letrec like this {{{ let f = [g] \r [...] -> ... g = [g] \r [...] -> ... in ... g ... }}} is sent to the code generator ''without dropping'' `f`. A patch to use a dependency analysis in !CorePrep's dead code eliminator improves allocation for several nofib programs (largest: cryptarithm2, knights, fem). {{{ Min -0.0% -4.2% -7.7% -7.7% -5.9% Max +0.0% +0.0% +4.3% +4.3% +14.3% Geometric Mean -0.0% -0.1% -0.2% -0.2% +0.2% }}} -- -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7796#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC