
#12150: Compile time performance degradation on code that uses undefined/error with
CallStacks
-------------------------------------+-------------------------------------
Reporter: thomie | Owner:
Type: bug | Status: new
Priority: high | Milestone: 8.0.2
Component: Compiler | Version: 8.0.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Compile-time | Unknown/Multiple
performance bug | Test Case:
Blocked By: | Blocking:
Related Tickets: #10844 | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by gridaphobe):
So, although my no-inline patch is now producing better results for the
original CallStack-inlining issue, it doesn't seem to be doing much for
this issue. Upon closer inspection of the Core I noticed something quite
interesting. When we remove the CallStacks from `undefined`, GHC manages
to optimize away the entire set of guards! In stark contrast, leaving the
CallStacks gives us the following Core
{{{
-- RHS size: {terms: 4, types: 7, coercions: 0}
Test.$fFunctorResult_$cfmap [InlPrag=INLINE (sat-args=0)]
:: forall a_aFQ b_aFR.
(a_aFQ -> b_aFR) -> Result a_aFQ -> Result b_aFR
[GblId,
Str=b,
Unf=Unf{Src=InlineStable, TopLvl=True, Value=False, ConLike=False,
WorkFree=False, Expandable=False,
Guidance=ALWAYS_IF(arity=0,unsat_ok=False,boring_ok=False)
Tmpl= \ (@ a_aFS) (@ b_aFT) ->
let {
$dIP_s1QH :: GHC.Stack.Types.CallStack
[LclId]
$dIP_s1QH =
GHC.Stack.Types.pushCallStack
(Test.$fFunctorResult10, Test.$fFunctorResult8)
GHC.Stack.Types.emptyCallStack } in
let {
bool1_aqS :: forall a1_a1Dw. a1_a1Dw
[LclId]
bool1_aqS =
\ (@ a1_a1Dw) ->
undefined
@ 'GHC.Types.PtrRepLifted
@ a1_a1Dw
($dIP_s1QH
`cast` (Sym
(GHC.Classes.N:IP[0]
<"callStack">_N