cmmMiniInline counts the uses of local variables, so it can easily
eliminate assigments to unused locals. This almost never gets
triggered, as we don't generate any dead assignments, but it will be
needed by a forthcoming cleanup in CgUtils.emitSwitch.
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
=