-dumpUDs bndrs uds body
- = (free_uds, foldr add_let body dict_binds)
- where
- (free_uds, (dict_binds, _)) = splitUDs bndrs uds
- add_let (bind,_) body = Let bind body
-
-splitUDs :: [CoreBndr]
- -> UsageDetails
- -> (UsageDetails, -- These don't mention the binders
- ProtoUsageDetails) -- These do
-
-splitUDs bndrs uds@(MkUD {dict_binds = orig_dbs,
- calls = orig_calls})
-
- = if isEmptyBag dump_dbs && null dump_calls then
- -- Common case: binder doesn't affect floats
- (uds, ([],[]))
-
- else
- -- Binders bind some of the fvs of the floats
- (MkUD {dict_binds = free_dbs,
- calls = listToCallDetails free_calls},
- (bagToList dump_dbs, dump_calls)
- )
-
+dumpUDs bndrs (MkUD { dict_binds = orig_dbs
+ , calls = orig_calls
+ , ud_fvs = fvs}) body
+ = (MkUD { dict_binds = free_dbs
+ , calls = free_calls
+ , ud_fvs = fvs `minusVarSet` bndr_set}, -- This may delete fewer variables
+ foldrBag add_let body dump_dbs) -- than in priciple possible