X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Fcmm%2FCmmOpt.hs;h=b96aa4aa8910ec70a2916b6644a825414911bcb5;hp=320f0a5ccfa88d3defc95c338046a0aac60ebee3;hb=ae72991e2f0343c075a30c0a5a7d4ac18e9ef500;hpb=982c1f494de8a691294a95aee108e765c3f592a0 diff --git a/compiler/cmm/CmmOpt.hs b/compiler/cmm/CmmOpt.hs index 320f0a5..b96aa4a 100644 --- a/compiler/cmm/CmmOpt.hs +++ b/compiler/cmm/CmmOpt.hs @@ -102,6 +102,11 @@ cmmMiniInline blocks = map do_inline blocks cmmMiniInlineStmts :: UniqFM Int -> [CmmStmt] -> [CmmStmt] cmmMiniInlineStmts uses [] = [] cmmMiniInlineStmts uses (stmt@(CmmAssign (CmmLocal (LocalReg u _ _)) expr) : stmts) + -- not used at all: just discard this assignment + | Nothing <- lookupUFM uses u + = cmmMiniInlineStmts uses stmts + + -- used once: try to inline at the use site | Just 1 <- lookupUFM uses u, Just stmts' <- lookForInline u expr stmts = @@ -341,7 +346,10 @@ cmmMachOpFold cmp [CmmMachOp conv [x], CmmLit (CmmInt i _)] = cmmMachOpFold narrow_cmp [x, CmmLit (CmmInt narrow_i rep)] where maybe_conversion (MO_U_Conv from _) = Just (from, narrowU) - maybe_conversion (MO_S_Conv from _) = Just (from, narrowS) + maybe_conversion (MO_S_Conv from _) + | not (isFloatingRep from) = Just (from, narrowS) + -- don't attempt to apply this optimisation when the source + -- is a float; see #1916 maybe_conversion _ = Nothing maybe_comparison (MO_U_Gt _) rep = Just (MO_U_Gt rep)