Wolfgang Jeltsch pushed to branch wip/jeltsch/more-efficient-home-unit-imports-finding at Glasgow Haskell Compiler / GHC Commits: 24433502 by Wolfgang Jeltsch at 2026-04-29T13:07:28+03:00 Drop the removal of any home unit from the dependencies - - - - - 1 changed file: - compiler/GHC/Unit/Finder.hs Changes: ===================================== compiler/GHC/Unit/Finder.hs ===================================== @@ -252,32 +252,26 @@ findImportedModuleNoHsc fc fopts ue home_module_name_providers_map mb_home_unit hpt_deps :: Set.Set UnitId hpt_deps = homeUnitDepends units - sorted_deps = sortHomeUnitsByLikelihoodFor home_module_name_providers_map mb_home_unit_id mod_name hpt_deps + sorted_deps = sortHomeUnitsByLikelihoodFor home_module_name_providers_map mod_name hpt_deps other_fopts = [ (uid, initFinderOpts (homeUnitEnv_dflags (ue_findHomeUnitEnv uid ue))) | uid <- sorted_deps ] -sortHomeUnitsByLikelihoodFor :: HomeModuleNameProvidersMap -> Maybe UnitId -> ModuleName -> Set.Set UnitId -> [UnitId] -sortHomeUnitsByLikelihoodFor _ _ _ hpt_deps | Set.null hpt_deps = [] +sortHomeUnitsByLikelihoodFor :: HomeModuleNameProvidersMap -> ModuleName -> Set.Set UnitId -> [UnitId] +sortHomeUnitsByLikelihoodFor _ _ hpt_deps | Set.null hpt_deps = [] {- With the above shortcut, evaluation of the module graph will not be triggered. -} -sortHomeUnitsByLikelihoodFor home_module_name_providers_map mb_home_unit_id mod_name hpt_deps = +sortHomeUnitsByLikelihoodFor home_module_name_providers_map mod_name hpt_deps = let cached_module_providers = lookupWithDefaultUniqMap home_module_name_providers_map Set.empty mod_name - cached_providing_deps = Set.intersection cached_module_providers hpt_deps - other_cached_providing_deps = - Set.toList $ - maybe cached_providing_deps (\u -> Set.delete u cached_providing_deps) mb_home_unit_id - uncached_providing_deps = - let candidates = Set.difference hpt_deps cached_module_providers - excluded = maybe Set.empty Set.singleton mb_home_unit_id - in Set.toList (Set.difference candidates excluded) - - all_deps = other_cached_providing_deps ++ uncached_providing_deps + cached_providing_deps = Set.toList (Set.intersection hpt_deps cached_module_providers) + uncached_providing_deps = Set.toList (Set.difference hpt_deps cached_module_providers) + + all_deps = cached_providing_deps ++ uncached_providing_deps in assertPpr (hpt_deps == Set.fromList all_deps) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/244335024d8774223e57bb857567fb73... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/244335024d8774223e57bb857567fb73... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Wolfgang Jeltsch (@jeltsch)