
#13390: Strict literal float-out during desugaring regresses T1969 at -O0 -------------------------------------+------------------------------------- Reporter: bgamari | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.4.1 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 dfeuer): All right. I took another look at what's going on in HEAD (without the string literal patch). It looks like I missed one piece: rules. So here's something more like the real story. We start out with {{{ $cc_aT4 :: A1 -> String $cc_aT4 = \ (ds_dUh :: A1) -> case ds_dUh of { A1 -> GHC.CString.unpackCString# "A1"# } T1969.$dme :: forall a. C a => a -> String T1969.$dme = \ (@ a_aog) ($dC_aSS :: C a_aog) (x_aoi :: a_aog) -> c @ a_aog $dC_aSS x_aoi T1969.$dmd :: forall a. C a => a -> String T1969.$dmd = \ (@ a_aog) ($dC_aSS :: C a_aog) (x_aoh :: a_aog) -> c @ a_aog $dC_aSS x_aoh Rec { T1969.$fCA1 :: C A1 T1969.$fCA1 = T1969.C:C @ A1 $cc_aT4 $cd_aT8 $ce_aTf $ce_aTf :: A1 -> String $ce_aTf = T1969.$dme @ A1 T1969.$fCA1 $cd_aT8 :: A1 -> String $cd_aT8 = T1969.$dmd @ A1 T1969.$fCA1 end Rec } }}} Then `$dme` inlines, producing {{{ $ce_aTf :: A1 -> String $ce_aTf = (\ (@ a_aog) ($dC_aSS :: C a_aog) (x_aoi :: a_aog) -> c @ a_aog $dC_aSS x_aoi) @ A1 T1969.$fCA1 }}} which reduces to {{{ $ce_aTf :: A1 -> String $ce_aTf = \ (x_aoi :: A1) -> c @ A1 T1969.$fCA1 x_aoi }}} Then the class op rule for `c @A1` fires, turning this into {{{ $ce_aTf :: A1 -> String $ce_aTf = \ (x_aoi :: A1) -> $cc_aT4 x_aoi }}} The same thing happens to `$dmd` and `$cd_aT8`. At some point, I believe both `ce_aTf` and `cd_aT8` must both get eta-reduced to `$cc_aT4` (which is perfectly legitimate because `$cc_aT4` is strict in its argument). `-ddump-inlinings` on its own doesn't show any further inlining, but `-dverbose-core2core` (if I'm reading it right) shows that the eta-reduced versions are indeed inlined into the constructor. These are trivial inlinings, replacing one binding with another, which should get around your statement that we don't (and don't want to) inline into constructor arguments. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13390#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler