diff options
author | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2018-11-26 12:00:02 +0300 |
---|---|---|
committer | Ömer Sinan Ağacan <omeragacan@gmail.com> | 2018-11-26 12:00:02 +0300 |
commit | 8a6aa87766a47f7f2f11642f770a52c0a91fc554 (patch) | |
tree | 56374f217b8da3ba94d91dd03dfeaefc2e21ec66 /compiler/codeGen | |
parent | 9e47dd32e238ed0c4c39035f47e0843ddccb5175 (diff) | |
download | haskell-8a6aa87766a47f7f2f11642f770a52c0a91fc554.tar.gz |
Revert "Remove redundant check in cgCase"
This reverts commit d13b7d60650cb84af11ee15b3f51c3511548cfdb.
(See discussion in D5358)
Diffstat (limited to 'compiler/codeGen')
-rw-r--r-- | compiler/codeGen/StgCmmExpr.hs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/compiler/codeGen/StgCmmExpr.hs b/compiler/codeGen/StgCmmExpr.hs index 5844161fc1..ea64e456ce 100644 --- a/compiler/codeGen/StgCmmExpr.hs +++ b/compiler/codeGen/StgCmmExpr.hs @@ -304,10 +304,13 @@ cgCase (StgOpApp (StgPrimOp op) args _) bndr (AlgAlt tycon) alts | isEnumerationTyCon tycon -- Note [case on bool] = do { tag_expr <- do_enum_primop op args - ; dflags <- getDynFlags - ; tmp_reg <- bindArgToReg (NonVoid bndr) - ; emitAssign (CmmLocal tmp_reg) - (tagToClosure dflags tycon tag_expr) + -- If the binder is not dead, convert the tag to a constructor + -- and assign it. + ; unless (isDeadBinder bndr) $ do + { dflags <- getDynFlags + ; tmp_reg <- bindArgToReg (NonVoid bndr) + ; emitAssign (CmmLocal tmp_reg) + (tagToClosure dflags tycon tag_expr) } ; (mb_deflt, branches) <- cgAlgAltRhss (NoGcInAlts,AssignedDirectly) (NonVoid bndr) alts |