diff options
Diffstat (limited to 'compiler/GHC/Core/Opt/Specialise.hs')
-rw-r--r-- | compiler/GHC/Core/Opt/Specialise.hs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/GHC/Core/Opt/Specialise.hs b/compiler/GHC/Core/Opt/Specialise.hs index 74ee8d1f5f..2e18049dd7 100644 --- a/compiler/GHC/Core/Opt/Specialise.hs +++ b/compiler/GHC/Core/Opt/Specialise.hs @@ -1114,7 +1114,10 @@ specExpr env (Tick tickish body) specExpr env expr@(App {}) = do { let (fun_in, args_in) = collectArgs expr ; (args_out, uds_args) <- mapAndCombineSM (specExpr env) args_in - ; let (fun_in', args_out') = rewriteClassOps env fun_in args_out + ; let env_args = env `bringFloatedDictsIntoScope` ud_binds uds_args + -- Some dicts may have floated out of args_in; + -- they should be in scope for rewriteClassOps (#21689) + (fun_in', args_out') = rewriteClassOps env_args fun_in args_out ; (fun_out', uds_fun) <- specExpr env fun_in' ; let uds_call = mkCallUDs env fun_out' args_out' ; return (fun_out' `mkApps` args_out', uds_fun `thenUDs` uds_call `thenUDs` uds_args) } @@ -1488,7 +1491,8 @@ specCalls spec_imp env dict_binds existing_rules calls_for_me fn rhs already_covered :: [CoreRule] -> [CoreExpr] -> Bool already_covered new_rules args -- Note [Specialisations already covered] - = isJust (specLookupRule env fn args (new_rules ++ existing_rules)) + = isJust (specLookupRule env_with_dict_bndrs fn args + (new_rules ++ existing_rules)) -- NB: we look both in the new_rules (generated by this invocation -- of specCalls), and in existing_rules (passed in to specCalls) |