summaryrefslogtreecommitdiff
path: root/compiler/GHC/Core/Utils.hs
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2021-04-30 11:28:21 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-04-30 23:23:26 -0400
commite61d2d47c4942c829ec98016be5aa5ae36982524 (patch)
tree956c9760157e117d723d65a72dba3f4a20ac699f /compiler/GHC/Core/Utils.hs
parent460afbe676715e4b8d75af79e9700ceebcf62eed (diff)
downloadhaskell-e61d2d47c4942c829ec98016be5aa5ae36982524.tar.gz
Make sized division primops ok-for-spec (#19026)
Diffstat (limited to 'compiler/GHC/Core/Utils.hs')
-rw-r--r--compiler/GHC/Core/Utils.hs15
1 files changed, 1 insertions, 14 deletions
diff --git a/compiler/GHC/Core/Utils.hs b/compiler/GHC/Core/Utils.hs
index cee7d4f68b..01b35f4b1f 100644
--- a/compiler/GHC/Core/Utils.hs
+++ b/compiler/GHC/Core/Utils.hs
@@ -1633,7 +1633,7 @@ app_ok primop_ok fun args
-- to take the arguments into account
PrimOpId op
- | isDivOp op
+ | primOpIsDiv op
, [arg1, Lit lit] <- args
-> not (isZeroLit lit) && expr_ok primop_ok arg1
-- Special case for dividing operations that fail
@@ -1686,19 +1686,6 @@ altsAreExhaustive (Alt con1 _ _ : alts)
-- we behave conservatively here -- I don't think it's important
-- enough to deserve special treatment
--- | True of dyadic operators that can fail only if the second arg is zero!
-isDivOp :: PrimOp -> Bool
--- This function probably belongs in GHC.Builtin.PrimOps, or even in
--- an automagically generated file.. but it's such a
--- special case I thought I'd leave it here for now.
-isDivOp IntQuotOp = True
-isDivOp IntRemOp = True
-isDivOp WordQuotOp = True
-isDivOp WordRemOp = True
-isDivOp FloatDivOp = True
-isDivOp DoubleDivOp = True
-isDivOp _ = False
-
{- Note [exprOkForSpeculation: case expressions]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
exprOkForSpeculation accepts very special case expressions.