[commit: ghc] master: RegAlloc: Make some pattern matched complete (a2bedb5)
git at git.haskell.org
git at git.haskell.org
Thu Oct 6 21:48:12 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/a2bedb5c67b8d0d20dfb22fdeac3fcd07fe5452e/ghc
>---------------------------------------------------------------
commit a2bedb5c67b8d0d20dfb22fdeac3fcd07fe5452e
Author: Joachim Breitner <mail at joachim-breitner.de>
Date: Wed Oct 5 23:37:03 2016 -0400
RegAlloc: Make some pattern matched complete
these actually are complete, but due to the use of pattern guards, the
compiler does not see that. Refactor the code that it does.
Differential Revision: https://phabricator.haskell.org/D2574
>---------------------------------------------------------------
a2bedb5c67b8d0d20dfb22fdeac3fcd07fe5452e
compiler/nativeGen/RegAlloc/Graph/Main.hs | 3 +++
compiler/nativeGen/RegAlloc/Liveness.hs | 10 +++++-----
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/compiler/nativeGen/RegAlloc/Graph/Main.hs b/compiler/nativeGen/RegAlloc/Graph/Main.hs
index 97c2b42..e819fe8 100644
--- a/compiler/nativeGen/RegAlloc/Graph/Main.hs
+++ b/compiler/nativeGen/RegAlloc/Graph/Main.hs
@@ -360,6 +360,9 @@ graphAddCoalesce (r1, r2) graph
, RegReal _ <- r2
= graph
+ | otherwise
+ = panic "graphAddCoalesce"
+
-- | Patch registers in code using the reg -> reg mapping in this graph.
patchRegsFromGraph
diff --git a/compiler/nativeGen/RegAlloc/Liveness.hs b/compiler/nativeGen/RegAlloc/Liveness.hs
index ea010a5..988bda0 100644
--- a/compiler/nativeGen/RegAlloc/Liveness.hs
+++ b/compiler/nativeGen/RegAlloc/Liveness.hs
@@ -897,12 +897,9 @@ livenessForward
livenessForward _ _ [] = []
livenessForward platform rsLiveEntry (li@(LiveInstr instr mLive) : lis)
- | Nothing <- mLive
- = li : livenessForward platform rsLiveEntry lis
-
- | Just live <- mLive
- , RU _ written <- regUsageOfInstr platform instr
+ | Just live <- mLive
= let
+ RU _ written = regUsageOfInstr platform instr
-- Regs that are written to but weren't live on entry to this instruction
-- are recorded as being born here.
rsBorn = mkUniqSet
@@ -915,6 +912,9 @@ livenessForward platform rsLiveEntry (li@(LiveInstr instr mLive) : lis)
in LiveInstr instr (Just live { liveBorn = rsBorn })
: livenessForward platform rsLiveNext lis
+ | otherwise
+ = li : livenessForward platform rsLiveEntry lis
+
-- | Calculate liveness going backwards,
-- filling in when regs die, and what regs are live across each instruction
More information about the ghc-commits
mailing list