summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2012-08-09 16:55:15 +0100
committerSimon Marlow <marlowsd@gmail.com>2012-10-05 16:11:30 +0100
commitaed37acd4d157791381800d5de960a2461bcbef3 (patch)
tree8ac9bd20e79fc591faf633947d049294e121ad18 /compiler
parent4a138b708463a99a1087ce2d8a70239de3aa04e4 (diff)
downloadhaskell-aed37acd4d157791381800d5de960a2461bcbef3.tar.gz
Add a ToDo comment
Diffstat (limited to 'compiler')
-rw-r--r--compiler/cmm/CmmSink.hs21
1 files changed, 21 insertions, 0 deletions
diff --git a/compiler/cmm/CmmSink.hs b/compiler/cmm/CmmSink.hs
index 7acc4dd460..2ff9b98d2a 100644
--- a/compiler/cmm/CmmSink.hs
+++ b/compiler/cmm/CmmSink.hs
@@ -465,6 +465,27 @@ data AbsMem
-- Note that SpMem is invalidated if Sp is changed, but the definition
-- of 'conflicts' above handles that.
+-- ToDo: this won't currently fix the following commonly occurring code:
+-- x1 = [R1 + 8]
+-- x2 = [R1 + 16]
+-- ..
+-- [Hp - 8] = x1
+-- [Hp - 16] = x2
+-- ..
+
+-- because [R1 + 8] and [Hp - 8] are both HeapMem. We know that
+-- assignments to [Hp + n] do not conflict with any other heap memory,
+-- but this is tricky to nail down. What if we had
+--
+-- x = Hp + n
+-- [x] = ...
+--
+-- the store to [x] should be "new heap", not "old heap".
+-- Furthermore, you could imagine that if we started inlining
+-- functions in Cmm then there might well be reads of heap memory
+-- that was written in the same basic block. To take advantage of
+-- non-aliasing of heap memory we will have to be more clever.
+
bothMems :: AbsMem -> AbsMem -> AbsMem
bothMems NoMem x = x
bothMems x NoMem = x