CPR analysis: Use CPR of scrutinee for Case Binder CPR (#19232)
For years we have lived in a supposedly sweet spot that gave case binders the CPR property, unconditionally. Which is an optimistic hack that is now described in `Historical Note [Optimistic case binder CPR]`. In #19232 the concern was raised that this might do more harm than good and that might be better off simply by taking the CPR property of the scrutinee for the CPR type of the case binder. And indeed that's what we do now. Since `Note [CPR in a DataAlt case alternative]` is now only about field binders, I renamed and garbage collected it into `Note [Optimistic field binder CPR]`. NoFib approves: ``` NoFib Results -------------------------------------------------------------------------------- Program Allocs Instrs -------------------------------------------------------------------------------- anna +0.1% +0.1% nucleic2 -1.2% -0.6% sched 0.0% +0.9% transform -0.0% -0.1% -------------------------------------------------------------------------------- Min -1.2% -0.6% Max +0.1% +0.9% Geometric Mean -0.0% +0.0% ``` Fixes #19232.
Showing
- compiler/GHC/Core/Opt/CprAnal.hs 130 additions, 107 deletionscompiler/GHC/Core/Opt/CprAnal.hs
- testsuite/tests/cpranal/sigs/CaseBinderCPR.hs 6 additions, 0 deletionstestsuite/tests/cpranal/sigs/CaseBinderCPR.hs
- testsuite/tests/cpranal/sigs/CaseBinderCPR.stderr 7 additions, 0 deletionstestsuite/tests/cpranal/sigs/CaseBinderCPR.stderr
- testsuite/tests/cpranal/sigs/Makefile 3 additions, 0 deletionstestsuite/tests/cpranal/sigs/Makefile
- testsuite/tests/cpranal/sigs/T19232.hs 14 additions, 0 deletionstestsuite/tests/cpranal/sigs/T19232.hs
- testsuite/tests/cpranal/sigs/T19232.stderr 6 additions, 0 deletionstestsuite/tests/cpranal/sigs/T19232.stderr
- testsuite/tests/cpranal/sigs/all.T 9 additions, 0 deletionstestsuite/tests/cpranal/sigs/all.T
- testsuite/tests/stranal/sigs/CaseBinderCPR.stderr 0 additions, 18 deletionstestsuite/tests/stranal/sigs/CaseBinderCPR.stderr
- testsuite/tests/stranal/sigs/all.T 0 additions, 1 deletiontestsuite/tests/stranal/sigs/all.T
Loading
Please register or sign in to comment