summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAustin Seipp <aseipp@pobox.com>2013-08-10 22:39:15 -0500
committerAustin Seipp <aseipp@pobox.com>2013-08-10 23:12:27 -0500
commite2b72cadce3ae799a74981f9957b40bb201f1ba1 (patch)
treebba6e9247351c4ef646a758422458946132f0c28
parent94be58893b084af0dc1a65b0faaa453a23fe6750 (diff)
downloadhaskell-e2b72cadce3ae799a74981f9957b40bb201f1ba1.tar.gz
Mark retry# as returning bottom.
This change helps the simplifier eliminate unreachable code, since retry# technically doesn't return. This closes ticket #8091. Authored-by: Patrick Palka <patrick@parcs.ath.cx> Signed-off-by: Austin Seipp <aseipp@pobox.com>
-rw-r--r--compiler/prelude/primops.txt.pp15
1 files changed, 15 insertions, 0 deletions
diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp
index 3d3518b095..0c325a6259 100644
--- a/compiler/prelude/primops.txt.pp
+++ b/compiler/prelude/primops.txt.pp
@@ -1611,9 +1611,24 @@ primop AtomicallyOp "atomically#" GenPrimOp
out_of_line = True
has_side_effects = True
+-- NB: retry#'s strictness information specifies it to return bottom.
+-- This lets the compiler perform some extra simplifications, since retry#
+-- will technically never return.
+--
+-- This allows the simplifier to replace things like:
+--
+-- case retry# s1
+-- (# s2, a #) -> e
+--
+-- with:
+--
+-- retry# s1
+--
+-- where 'e' would be unreachable anyway.
primop RetryOp "retry#" GenPrimOp
State# RealWorld -> (# State# RealWorld, a #)
with
+ strictness = { \ _arity -> mkStrictSig (mkTopDmdType [topDmd] botRes) }
out_of_line = True
has_side_effects = True