[commit: ghc] wip/T10137: CmmSwitch: Use mkWordCLit (d4b8168)

git at git.haskell.org git at git.haskell.org
Tue Mar 10 13:56:44 UTC 2015


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

On branch  : wip/T10137
Link       : http://ghc.haskell.org/trac/ghc/changeset/d4b8168428d4e6bba9a2b6a828135beced7024eb/ghc

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

commit d4b8168428d4e6bba9a2b6a828135beced7024eb
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Tue Mar 10 14:56:41 2015 +0100

    CmmSwitch: Use mkWordCLit


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

d4b8168428d4e6bba9a2b6a828135beced7024eb
 compiler/cmm/CmmCreateSwitchPlans.hs | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/compiler/cmm/CmmCreateSwitchPlans.hs b/compiler/cmm/CmmCreateSwitchPlans.hs
index df935fc..7784fcf 100644
--- a/compiler/cmm/CmmCreateSwitchPlans.hs
+++ b/compiler/cmm/CmmCreateSwitchPlans.hs
@@ -63,7 +63,6 @@ implementSwitchPlan dflags signed expr = go
         (bid1, newBlocks1) <- go' ids1
         (bid2, newBlocks2) <- go' ids2
 
-        -- TODO: Is this cast safe?
         let lt | signed    = cmmSLtWord
                | otherwise = cmmULtWord
             scrut = lt dflags expr $ CmmLit $ mkWordCLit dflags i
@@ -74,8 +73,7 @@ implementSwitchPlan dflags signed expr = go
       = do
         (bid2, newBlocks2) <- go' ids2
 
-        -- TODO: Is this cast safe?
-        let scrut = cmmNeWord dflags expr (mkIntExpr dflags (fromIntegral i))
+        let scrut = cmmNeWord dflags expr $ CmmLit $ mkWordCLit dflags i
             lastNode = CmmCondBranch scrut bid2 l
             lastBlock = emptyBlock `blockJoinTail` lastNode
         return (lastBlock, newBlocks2)



More information about the ghc-commits mailing list