summaryrefslogtreecommitdiff
path: root/compiler/codeGen
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2017-03-10 11:12:12 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2017-03-10 13:00:48 +0000
commitbc0f3abd0914808e33f84229818ab90842611bdd (patch)
tree99c64e30c11664a6de45446c183751958eef70a7 /compiler/codeGen
parent900cfdc2700ad9e8c7a12dd25bb0396e5e7651df (diff)
downloadhaskell-bc0f3abd0914808e33f84229818ab90842611bdd.tar.gz
Deal with JoinIds before void types
Trac #13394, comment:4 showed up another place where we were testing for the representation of of a type; and it turned out to be a JoinId which can be rep-polymorphic. Just putting the test in the right places solves this easily.
Diffstat (limited to 'compiler/codeGen')
-rw-r--r--compiler/codeGen/StgCmmExpr.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/codeGen/StgCmmExpr.hs b/compiler/codeGen/StgCmmExpr.hs
index 395e8d6fa6..39edd05a8e 100644
--- a/compiler/codeGen/StgCmmExpr.hs
+++ b/compiler/codeGen/StgCmmExpr.hs
@@ -701,7 +701,6 @@ cgConApp con stg_args
; emitReturn [idInfoToAmode idinfo] }
cgIdApp :: Id -> [StgArg] -> FCode ReturnKind
-cgIdApp fun_id [] | isVoidTy (idType fun_id) = emitReturn []
cgIdApp fun_id args = do
dflags <- getDynFlags
fun_info <- getCgIdInfo fun_id
@@ -719,9 +718,11 @@ cgIdApp fun_id args = do
v_args = length $ filter (isVoidTy . stgArgType) args
node_points dflags = nodeMustPointToIt dflags lf_info
case getCallMethod dflags fun_name cg_fun_id lf_info n_args v_args (cg_loc fun_info) self_loop_info of
-
-- A value in WHNF, so we can just return it.
- ReturnIt -> emitReturn [fun] -- ToDo: does ReturnIt guarantee tagged?
+ ReturnIt
+ | isVoidTy (idType fun_id) -> emitReturn []
+ | otherwise -> emitReturn [fun]
+ -- ToDo: does ReturnIt guarantee tagged?
EnterIt -> ASSERT( null args ) -- Discarding arguments
emitEnter fun