X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2FsimplCore%2FOccurAnal.lhs;h=ae5c291ef6edb894270342dfd04b748ca7fb2027;hp=a931f29eaface65bb102b97d30b311d9289efdac;hb=4f990f3489edb0992dcf2a36ffafefc5d02db818;hpb=eaeca51efc0be3ff865c4530137bfbe9f8553549 diff --git a/compiler/simplCore/OccurAnal.lhs b/compiler/simplCore/OccurAnal.lhs index a931f29..ae5c291 100644 --- a/compiler/simplCore/OccurAnal.lhs +++ b/compiler/simplCore/OccurAnal.lhs @@ -22,6 +22,7 @@ import CoreFVs import CoreUtils ( exprIsTrivial, isDefaultAlt ) import Coercion ( mkSymCoercion ) import Id +import Name ( localiseName ) import IdInfo import BasicTypes @@ -1153,12 +1154,15 @@ occAnalAlt env case_bndr mb_scrut_var (con, bndrs, rhs) , not (any shadowing bndrs) -- (b) -> (addOneOcc usg_wo_scrut case_bndr NoOccInfo, -- See Note [Case binder usage] for the NoOccInfo - (con, bndrs', Let (NonRec scrut_var' scrut_rhs) rhs')) + (con, bndrs', Let (NonRec scrut_var2 scrut_rhs) rhs')) where - (usg_wo_scrut, scrut_var') = tagBinder alt_usg (localiseId scrut_var) - -- Note the localiseId; we're making a new binding - -- for it, and it might have an External Name, or + scrut_var1 = mkLocalId (localiseName (idName scrut_var)) (idType scrut_var) + -- Localise the scrut_var before shadowing it; we're making a + -- new binding for it, and it might have an External Name, or -- even be a GlobalId; Note [Binder swap on GlobalId scrutinees] + -- Also we don't want any INLILNE or NOINLINE pragmas! + + (usg_wo_scrut, scrut_var2) = tagBinder alt_usg scrut_var1 shadowing bndr = bndr `elemVarSet` rhs_fvs rhs_fvs = exprFreeVars scrut_rhs