X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Fcmm%2FCmmOpt.hs;h=b96aa4aa8910ec70a2916b6644a825414911bcb5;hp=7c88add20412e3213bd736df359b74a7302905a7;hb=ae72991e2f0343c075a30c0a5a7d4ac18e9ef500;hpb=30665bdd7b657dd9ca77c20b2e1f224cc3f4d4e3 diff --git a/compiler/cmm/CmmOpt.hs b/compiler/cmm/CmmOpt.hs index 7c88add..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 = @@ -343,6 +348,8 @@ cmmMachOpFold cmp [CmmMachOp conv [x], CmmLit (CmmInt i _)] maybe_conversion (MO_U_Conv from _) = Just (from, narrowU) 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)