summaryrefslogtreecommitdiff
path: root/Optimiser.hs
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2019-12-14 22:56:31 +0100
committertomsmeding <tom.smeding@gmail.com>2019-12-14 22:56:31 +0100
commit638181c4f19f38898abf5ff41b891eaa62ea9325 (patch)
tree17ac7b80dab785bdf94741d08264d46b13f0892e /Optimiser.hs
parent6e62e5af36fa972c631ffc185cfa77c30a390b40 (diff)
Fix serious correctness issue in Optimiser globalPropAssignsHEADmaster
The optimisation pass would often not collect all assignments to a particular reference, so that it would wrongly conclude that a reference is only ever assigned once while it is actually assigned in multiple places. I have _no_ idea why this didn't result in issues before.
Diffstat (limited to 'Optimiser.hs')
-rw-r--r--Optimiser.hs1
1 files changed, 1 insertions, 0 deletions
diff --git a/Optimiser.hs b/Optimiser.hs
index c59c40e..4cff2ea 100644
--- a/Optimiser.hs
+++ b/Optimiser.hs
@@ -98,6 +98,7 @@ globalPropAssigns :: [BB] -> [BB]
globalPropAssigns bbs =
let asgmap = map ((,) <$> fst . head <*> map snd)
. groupBy ((==) `on` fst)
+ . sortOn fst
$ [pair | BB _ inss _ <- bbs, pair <- inss]
replacements = concatMap (\(dest, inss) -> case inss of
[IAssign ref@(RConst _)] -> [(dest, ref)]