[commit: ghc] master: Revert "Remove redundant check in cgCase" (8a6aa87)

git at git.haskell.org git at git.haskell.org
Mon Nov 26 09:00:39 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/8a6aa87766a47f7f2f11642f770a52c0a91fc554/ghc

>---------------------------------------------------------------

commit 8a6aa87766a47f7f2f11642f770a52c0a91fc554
Author: Ömer Sinan Ağacan <omeragacan at gmail.com>
Date:   Mon Nov 26 12:00:02 2018 +0300

    Revert "Remove redundant check in cgCase"
    
    This reverts commit d13b7d60650cb84af11ee15b3f51c3511548cfdb.
    
    (See discussion in D5358)


>---------------------------------------------------------------

8a6aa87766a47f7f2f11642f770a52c0a91fc554
 compiler/codeGen/StgCmmExpr.hs | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/compiler/codeGen/StgCmmExpr.hs b/compiler/codeGen/StgCmmExpr.hs
index 5844161..ea64e45 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



More information about the ghc-commits mailing list