summaryrefslogtreecommitdiff
path: root/compiler/coreSyn/CoreUtils.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/coreSyn/CoreUtils.hs')
-rw-r--r--compiler/coreSyn/CoreUtils.hs11
1 files changed, 7 insertions, 4 deletions
diff --git a/compiler/coreSyn/CoreUtils.hs b/compiler/coreSyn/CoreUtils.hs
index 6dfb1df462..55609cf4b1 100644
--- a/compiler/coreSyn/CoreUtils.hs
+++ b/compiler/coreSyn/CoreUtils.hs
@@ -1525,10 +1525,13 @@ expr_ok primop_ok (Case scrut bndr _ alts)
&& altsAreExhaustive alts
expr_ok primop_ok other_expr
- = case collectArgs other_expr of
- (expr, args) | Var f <- stripTicksTopE (not . tickishCounts) expr
- -> app_ok primop_ok f args
- _ -> False
+ | (expr, args) <- collectArgs other_expr
+ = case stripTicksTopE (not . tickishCounts) expr of
+ Var f -> app_ok primop_ok f args
+ -- 'RubbishLit' is the only literal that can occur in the head of an
+ -- application and will not be matched by the above case (Var /= Lit).
+ Lit lit -> ASSERT( lit == rubbishLit ) True
+ _ -> False
-----------------------------
app_ok :: (PrimOp -> Bool) -> Id -> [CoreExpr] -> Bool