diff options
author | Michael Sloan <mgsloan@gmail.com> | 2018-07-20 16:53:41 +0200 |
---|---|---|
committer | Krzysztof Gogolewski <krz.gogolewski@gmail.com> | 2018-07-20 16:53:41 +0200 |
commit | f64f06bebddd1dbfc6568f36fa1f91f758fa22f1 (patch) | |
tree | 0895f6e4e6e2862248f10f050dda46865f326953 /compiler/main/GHC.hs | |
parent | 99f45e2a751dda4fdf00256d397a2932d430f3a7 (diff) | |
download | haskell-f64f06bebddd1dbfc6568f36fa1f91f758fa22f1.tar.gz |
Avoid redundant invocation of 'findTopDir'
Summary:
While working on [D904](https://phabricator.haskell.org/D4904), I noticed that
'findTopDir' was being invoked three times. This isn't a big problem, because
it is usually very cheap. On windows, it does require some involved logic,
though, so to me it would make sense to only run it once.
Reviewers: bgamari, monoidal
Reviewed By: monoidal
Subscribers: rwbarton, thomie, carter
Differential Revision: https://phabricator.haskell.org/D4987
Diffstat (limited to 'compiler/main/GHC.hs')
-rw-r--r-- | compiler/main/GHC.hs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/main/GHC.hs b/compiler/main/GHC.hs index 2b25646d8d..0e20e21fdb 100644 --- a/compiler/main/GHC.hs +++ b/compiler/main/GHC.hs @@ -326,6 +326,7 @@ import HscTypes import CmdLineParser import DynFlags hiding (WarnReason(..)) import SysTools +import SysTools.BaseDir import Annotations import Module import Panic @@ -494,8 +495,9 @@ withCleanupSession ghc = ghc `gfinally` cleanup initGhcMonad :: GhcMonad m => Maybe FilePath -> m () initGhcMonad mb_top_dir = do { env <- liftIO $ - do { mySettings <- initSysTools mb_top_dir - ; myLlvmConfig <- initLlvmConfig mb_top_dir + do { top_dir <- findTopDir mb_top_dir + ; mySettings <- initSysTools top_dir + ; myLlvmConfig <- initLlvmConfig top_dir ; dflags <- initDynFlags (defaultDynFlags mySettings myLlvmConfig) ; checkBrokenTablesNextToCode dflags ; setUnsafeGlobalDynFlags dflags |