summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Graf <sebastian.graf@kit.edu>2020-07-03 18:32:36 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-09-02 15:54:55 -0400
commitbfab2a30be5cc68e7914c3f6bb9ae4ad33283ffc (patch)
tree9a8bd4f265617bd9af4a2dbe588664965b0b31c3
parentb4edcde70160820dd23c53d9019f895930e2c0e7 (diff)
downloadhaskell-bfab2a30be5cc68e7914c3f6bb9ae4ad33283ffc.tar.gz
Turn on -XMonoLocalBinds by default (#18430)
And fix the resulting type errors. Co-authored-by: Krzysztof Gogolewski <krz.gogolewski@gmail.com> Metric Decrease: parsing001
-rw-r--r--compiler/GHC/CmmToAsm/Reg/Linear.hs5
-rw-r--r--compiler/GHC/Core/Lint.hs1
-rw-r--r--compiler/GHC/Core/Opt/Simplify.hs2
-rw-r--r--compiler/GHC/Driver/Make.hs6
-rw-r--r--compiler/GHC/Runtime/Linker.hs1
-rw-r--r--compiler/GHC/SysTools.hs12
-rw-r--r--compiler/ghc.cabal.in1
7 files changed, 17 insertions, 11 deletions
diff --git a/compiler/GHC/CmmToAsm/Reg/Linear.hs b/compiler/GHC/CmmToAsm/Reg/Linear.hs
index 8d4da4bd2e..34e5e71205 100644
--- a/compiler/GHC/CmmToAsm/Reg/Linear.hs
+++ b/compiler/GHC/CmmToAsm/Reg/Linear.hs
@@ -205,7 +205,7 @@ regAlloc _ (CmmProc _ _ _ _)
-- an entry in the block map or it is the first block.
--
linearRegAlloc
- :: Instruction instr
+ :: forall instr. Instruction instr
=> NCGConfig
-> [BlockId] -- ^ entry points
-> BlockMap RegSet
@@ -231,6 +231,8 @@ linearRegAlloc config entry_ids block_live sccs
ArchJavaScript -> panic "linearRegAlloc ArchJavaScript"
ArchUnknown -> panic "linearRegAlloc ArchUnknown"
where
+ go :: (FR regs, Outputable regs)
+ => regs -> UniqSM ([NatBasicBlock instr], RegAllocStats, Int)
go f = linearRegAlloc' config f entry_ids block_live sccs
platform = ncgPlatform config
@@ -973,4 +975,3 @@ loadTemp vreg (ReadMem slot) hreg spills
loadTemp _ _ _ spills =
return spills
-
diff --git a/compiler/GHC/Core/Lint.hs b/compiler/GHC/Core/Lint.hs
index 9054ca086c..69cd263699 100644
--- a/compiler/GHC/Core/Lint.hs
+++ b/compiler/GHC/Core/Lint.hs
@@ -2290,6 +2290,7 @@ lintCoercion this@(AxiomRuleCo ax cos)
Nothing -> err "Malformed use of AxiomRuleCo" [ ppr this ]
Just _ -> return (AxiomRuleCo ax cos') }
where
+ err :: forall a. String -> [SDoc] -> LintM a
err m xs = failWithL $
hang (text m) 2 $ vcat (text "Rule:" <+> ppr (coaxrName ax) : xs)
diff --git a/compiler/GHC/Core/Opt/Simplify.hs b/compiler/GHC/Core/Opt/Simplify.hs
index 4895b312db..795605c557 100644
--- a/compiler/GHC/Core/Opt/Simplify.hs
+++ b/compiler/GHC/Core/Opt/Simplify.hs
@@ -1909,7 +1909,7 @@ completeCall env var cont
log_inlining $
sep [text "Inlining done:", nest 4 (ppr var)]
| otherwise
- = liftIO $ log_inlining $
+ = log_inlining $
sep [text "Inlining done: " <> ppr var,
nest 4 (vcat [text "Inlined fn: " <+> nest 2 (ppr unfolding),
text "Cont: " <+> ppr cont])]
diff --git a/compiler/GHC/Driver/Make.hs b/compiler/GHC/Driver/Make.hs
index 9e7870c638..1fcc539384 100644
--- a/compiler/GHC/Driver/Make.hs
+++ b/compiler/GHC/Driver/Make.hs
@@ -1373,7 +1373,8 @@ parUpsweep_one mod home_mod_map comp_graph_loops lcl_dflags mHscMessage cleanup
--
-- There better had not be any cyclic groups here -- we check for them.
upsweep
- :: GhcMonad m
+ :: forall m
+ . GhcMonad m
=> Maybe Messager
-> HomePackageTable -- ^ HPT from last time round (pruned)
-> StableModules -- ^ stable modules (see checkStability)
@@ -1415,8 +1416,7 @@ upsweep mHscMessage old_hpt stable_mods cleanup sccs = do
return (Failed, done')
upsweep'
- :: GhcMonad m
- => HomePackageTable
+ :: HomePackageTable
-> ModuleGraph
-> [SCC ModSummary]
-> Int
diff --git a/compiler/GHC/Runtime/Linker.hs b/compiler/GHC/Runtime/Linker.hs
index 4a3b03e5eb..6e0663b029 100644
--- a/compiler/GHC/Runtime/Linker.hs
+++ b/compiler/GHC/Runtime/Linker.hs
@@ -1134,6 +1134,7 @@ unload_wkr hsc_env keep_linkables pls@PersistentLinkerState{..} = do
-- Note that we want to remove all *local*
-- (i.e. non-isExternal) names too (these are the
-- temporary bindings from the command line).
+ keep_name :: (Name, a) -> Bool
keep_name (n,_) = isExternalName n &&
nameModule n `elemModuleSet` bcos_retained
diff --git a/compiler/GHC/SysTools.hs b/compiler/GHC/SysTools.hs
index f3b4f4cc87..57d1757fe9 100644
--- a/compiler/GHC/SysTools.hs
+++ b/compiler/GHC/SysTools.hs
@@ -138,15 +138,17 @@ lazyInitLlvmConfig :: String
-> IO LlvmConfig
lazyInitLlvmConfig top_dir
= unsafeInterleaveIO $ do -- see Note [LLVM configuration]
- targets <- readAndParse "llvm-targets" mkLlvmTarget
- passes <- readAndParse "llvm-passes" id
- return $ LlvmConfig { llvmTargets = targets, llvmPasses = passes }
+ targets <- readAndParse "llvm-targets"
+ passes <- readAndParse "llvm-passes"
+ return $ LlvmConfig { llvmTargets = fmap mkLlvmTarget <$> targets,
+ llvmPasses = passes }
where
- readAndParse name builder =
+ readAndParse :: Read a => String -> IO a
+ readAndParse name =
do let llvmConfigFile = top_dir </> name
llvmConfigStr <- readFile llvmConfigFile
case maybeReadFuzzy llvmConfigStr of
- Just s -> return (fmap builder <$> s)
+ Just s -> return s
Nothing -> pgmError ("Can't parse " ++ show llvmConfigFile)
mkLlvmTarget :: (String, String, String) -> LlvmTarget
diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in
index a05c101104..2a90db9c88 100644
--- a/compiler/ghc.cabal.in
+++ b/compiler/ghc.cabal.in
@@ -153,6 +153,7 @@ Library
NoImplicitPrelude
,BangPatterns
,ScopedTypeVariables
+ ,MonoLocalBinds
Exposed-Modules:
GHC.Iface.Ext.Types