From 277c2f26e6966e0cfaa1ddcd297af44766f37958 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Fri, 24 Apr 2020 17:22:44 -0400 Subject: Eta expand un-saturated primops Now since we no longer try to predict CAFfyness we have no need for the solution to #16846. Eta expanding unsaturated primop applications is conceptually simpler, especially in the presence of levity polymorphism. This essentially reverts cac8dc9f51e31e4c0a6cd9bc302f7e1bc7c03beb, as suggested in #18079. Closes #18079. --- compiler/GHC/CoreToStg/Prep.hs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'compiler/GHC/CoreToStg') diff --git a/compiler/GHC/CoreToStg/Prep.hs b/compiler/GHC/CoreToStg/Prep.hs index ac74dd6723..9b4690e016 100644 --- a/compiler/GHC/CoreToStg/Prep.hs +++ b/compiler/GHC/CoreToStg/Prep.hs @@ -71,7 +71,7 @@ import qualified Data.Set as S The goal of this pass is to prepare for code generation. -1. Saturate constructor applications. +1. Saturate constructor and primop applications. 2. Convert to A-normal form; that is, function arguments are always variables. @@ -1151,15 +1151,11 @@ maybeSaturate deals with eta expanding to saturate things that can't deal with unsaturated applications (identified by 'hasNoBinding', currently just foreign calls and unboxed tuple/sum constructors). -Note that eta expansion in CorePrep is very fragile due to the "prediction" of -CAFfyness made during tidying (see Note [CAFfyness inconsistencies due to eta -expansion in CorePrep] in GHC.Iface.Tidy for details. We previously saturated primop +Historical Note: Note that eta expansion in CorePrep used to be very fragile +due to the "prediction" of CAFfyness that we used to make during tidying. +We previously saturated primop applications here as well but due to this fragility (see #16846) we now deal with this another way, as described in Note [Primop wrappers] in GHC.Builtin.PrimOps. - -It's quite likely that eta expansion of constructor applications will -eventually break in a similar way to how primops did. We really should -eliminate this case as well. -} maybeSaturate :: Id -> CpeApp -> Int -> UniqSM CpeRhs -- cgit v1.2.1