summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornineonine <mail4chemik@gmail.com>2022-03-13 11:23:42 -0700
committerAndreas Klebinger <klebinger.andreas@gmx.at>2022-03-15 13:12:04 +0000
commit68af4769e2c67d0585e5afeb7daeec023c416d88 (patch)
treebcc5990b9e39176e6d828b7181547f7449a7afca
parent8ff32124c8cd37050f3dc7cbb32b8d41711ebcaf (diff)
downloadhaskell-wip/T21084.tar.gz
codeGen: not sink global assignments (#21084)wip/T21084
-rw-r--r--compiler/GHC/Cmm/Sink.hs6
1 files changed, 5 insertions, 1 deletions
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
--