summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2014-06-06 09:52:13 +0100
committerSimon Marlow <marlowsd@gmail.com>2014-06-06 18:03:29 +0100
commite577a52363ee7ee8a07f1d863988332ae8fbf2e4 (patch)
tree85ae41441df2d5b38676f95643acfd50b543ed25 /testsuite
parentb0215729214859051abf78f6cf5012805fe7d764 (diff)
downloadhaskell-e577a52363ee7ee8a07f1d863988332ae8fbf2e4.tar.gz
Fix discarding of unreachable code in the register allocator (#9155)
A previous fix to this was wrong: f5879acd018494b84233f26fba828ce376d0f81d and left some unreachable code behind. So rather than try to be clever and do this at the same time as the strongly-connected-component analysis, I'm doing a separate reachability pass first.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/codeGen/should_compile/T9155.hs30
-rw-r--r--testsuite/tests/codeGen/should_compile/all.T1
2 files changed, 31 insertions, 0 deletions
diff --git a/testsuite/tests/codeGen/should_compile/T9155.hs b/testsuite/tests/codeGen/should_compile/T9155.hs
new file mode 100644
index 0000000000..6fac0bcee6
--- /dev/null
+++ b/testsuite/tests/codeGen/should_compile/T9155.hs
@@ -0,0 +1,30 @@
+{-# LANGUAGE ScopedTypeVariables #-}
+module M () where
+
+import Data.Bits ((.&.))
+
+bitsSet :: Int -> Int -> Bool
+bitsSet mask i
+ = (i .&. mask == mask)
+
+class Eq b => BitMask b where
+ assocBitMask :: [(b,Int)]
+
+ fromBitMask :: Int -> b
+ fromBitMask i
+ = walk assocBitMask
+ where
+ walk [] = error "Graphics.UI.WX.Types.fromBitMask: empty list"
+ walk [(x,0)] = x
+ walk ((x,m):xs) | bitsSet m i = x
+ | otherwise = walk xs
+
+data Align = AlignLeft
+ | AlignCentre
+ deriving Eq
+
+instance BitMask Align where
+ assocBitMask
+ = [(AlignCentre,512)
+ ,(AlignLeft, 256)
+ ]
diff --git a/testsuite/tests/codeGen/should_compile/all.T b/testsuite/tests/codeGen/should_compile/all.T
index 487b6b653c..ae8d0dd24a 100644
--- a/testsuite/tests/codeGen/should_compile/all.T
+++ b/testsuite/tests/codeGen/should_compile/all.T
@@ -22,3 +22,4 @@ test('massive_array',
test('T7237', normal, compile, [''])
test('T7574', [cmm_src, omit_ways(['llvm', 'optllvm'])], compile, [''])
test('T8205', normal, compile, ['-O0'])
+test('T9155', normal, compile, ['-O2'])