From 68af4769e2c67d0585e5afeb7daeec023c416d88 Mon Sep 17 00:00:00 2001 From: nineonine Date: Sun, 13 Mar 2022 11:23:42 -0700 Subject: codeGen: not sink global assignments (#21084) --- compiler/GHC/Cmm/Sink.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/compiler/GHC/Cmm/Sink.hs b/compiler/GHC/Cmm/Sink.hs index 84f9317f21..b572aeaa0a 100644 --- a/compiler/GHC/Cmm/Sink.hs +++ b/compiler/GHC/Cmm/Sink.hs @@ -384,8 +384,12 @@ cmm_sink_sp. -- liveness analysis doesn't track those (yet) so we can't. -- shouldSink :: Platform -> CmmNode e x -> Maybe Assignment -shouldSink platform (CmmAssign (CmmLocal r) e) | no_local_regs = Just (r, e, exprMem platform e) +shouldSink platform (CmmAssign var e) | is_renamed_global var = Nothing + | (CmmLocal r) <- var + , no_local_regs = Just (r, e, exprMem platform e) where no_local_regs = True -- foldRegsUsed (\_ _ -> False) True e + is_renamed_global (CmmGlobal {}) = True + is_renamed_global _ = False shouldSink _ _other = Nothing -- -- cgit v1.2.1