From 9041cd4588ccd2e9304e2751845474c8f4b4d0d9 Mon Sep 17 00:00:00 2001 From: Simon Peyton Jones Date: Tue, 4 May 2021 08:29:21 +0100 Subject: Make RULE matching insensitive to eta-expansion This patch fixes #19790 by making the rule matcher do on-the-fly eta reduction. See Note [Eta reduction the target] in GHC.Core.Rules I found I also had to careful about casts when matching; see Note [Casts in the target] and Note [Casts in the template] Lots more comments and Notes in the rule matcher --- compiler/GHC/Core/Opt/Pipeline.hs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'compiler/GHC/Core/Opt/Pipeline.hs') diff --git a/compiler/GHC/Core/Opt/Pipeline.hs b/compiler/GHC/Core/Opt/Pipeline.hs index 8b1106904f..f6511439ac 100644 --- a/compiler/GHC/Core/Opt/Pipeline.hs +++ b/compiler/GHC/Core/Opt/Pipeline.hs @@ -162,16 +162,17 @@ getCoreToDo logger dflags maybe_strictness_before _ = CoreDoNothing - base_mode = SimplMode { sm_phase = panic "base_mode" - , sm_names = [] - , sm_dflags = dflags - , sm_logger = logger - , sm_uf_opts = unfoldingOpts dflags - , sm_rules = rules_on - , sm_eta_expand = eta_expand_on - , sm_inline = True - , sm_case_case = True - , sm_pre_inline = pre_inline_on + base_mode = SimplMode { sm_phase = panic "base_mode" + , sm_names = [] + , sm_dflags = dflags + , sm_logger = logger + , sm_uf_opts = unfoldingOpts dflags + , sm_rules = rules_on + , sm_eta_expand = eta_expand_on + , sm_cast_swizzle = True + , sm_inline = True + , sm_case_case = True + , sm_pre_inline = pre_inline_on } simpl_phase phase name iter -- cgit v1.2.1