diff options
-rw-r--r-- | compiler/GHC/CoreToStg/Prep.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Driver/Session.hs | 6 | ||||
-rw-r--r-- | compiler/GHC/HsToCore/Coverage.hs | 6 | ||||
-rw-r--r-- | compiler/GHC/IfaceToCore.hs | 4 |
4 files changed, 10 insertions, 8 deletions
diff --git a/compiler/GHC/CoreToStg/Prep.hs b/compiler/GHC/CoreToStg/Prep.hs index ac626931cd..8a6354147c 100644 --- a/compiler/GHC/CoreToStg/Prep.hs +++ b/compiler/GHC/CoreToStg/Prep.hs @@ -299,7 +299,7 @@ mkDataConWorkers dflags mod_loc data_tycons -- If we want to generate debug info, we put a source note on the -- worker. This is useful, especially for heap profiling. tick_it name - | debugLevel dflags == 0 = id + | not (needSourceNotes dflags) = id | RealSrcSpan span _ <- nameSrcSpan name = tick span | Just file <- ml_hs_file mod_loc = tick (span1 file) | otherwise = tick (span1 "???") diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs index 34d34815ce..f7d05d063d 100644 --- a/compiler/GHC/Driver/Session.hs +++ b/compiler/GHC/Driver/Session.hs @@ -40,6 +40,7 @@ module GHC.Driver.Session ( lang_set, DynamicTooState(..), dynamicTooState, setDynamicNow, sccProfilingEnabled, + needSourceNotes, DynFlags(..), outputFile, objectSuf, ways, FlagSpec(..), @@ -4841,6 +4842,11 @@ isBmi2Enabled dflags = case platformArch (targetPlatform dflags) of sccProfilingEnabled :: DynFlags -> Bool sccProfilingEnabled dflags = profileIsProfiling (targetProfile dflags) +-- | Indicate whether we need to generate source notes +needSourceNotes :: DynFlags -> Bool +needSourceNotes dflags = debugLevel dflags > 0 + || gopt Opt_InfoTableMap dflags + -- ----------------------------------------------------------------------------- -- Linker/compiler information diff --git a/compiler/GHC/HsToCore/Coverage.hs b/compiler/GHC/HsToCore/Coverage.hs index 1c6ef3eafa..c59beb402c 100644 --- a/compiler/GHC/HsToCore/Coverage.hs +++ b/compiler/GHC/HsToCore/Coverage.hs @@ -1066,17 +1066,13 @@ data TickTransEnv = TTE { fileName :: FastString data TickishType = ProfNotes | HpcTicks | Breakpoints | SourceNotes deriving (Eq) -sourceNotesEnabled :: DynFlags -> Bool -sourceNotesEnabled dflags = - (debugLevel dflags > 0) || (gopt Opt_InfoTableMap dflags) - coveragePasses :: DynFlags -> [TickishType] coveragePasses dflags = ifa (breakpointsEnabled dflags) Breakpoints $ ifa (gopt Opt_Hpc dflags) HpcTicks $ ifa (sccProfilingEnabled dflags && profAuto dflags /= NoProfAuto) ProfNotes $ - ifa (sourceNotesEnabled dflags) SourceNotes [] + ifa (needSourceNotes dflags) SourceNotes [] where ifa f x xs | f = x:xs | otherwise = xs diff --git a/compiler/GHC/IfaceToCore.hs b/compiler/GHC/IfaceToCore.hs index 2982df668d..2e98f45745 100644 --- a/compiler/GHC/IfaceToCore.hs +++ b/compiler/GHC/IfaceToCore.hs @@ -1553,9 +1553,9 @@ tcIfaceExpr (IfaceLet (IfaceRec pairs) body) tcIfaceExpr (IfaceTick tickish expr) = do expr' <- tcIfaceExpr expr -- If debug flag is not set: Ignore source notes - dbgLvl <- fmap debugLevel getDynFlags + need_notes <- needSourceNotes <$> getDynFlags case tickish of - IfaceSource{} | dbgLvl == 0 + IfaceSource{} | not (need_notes) -> return expr' _otherwise -> do tickish' <- tcIfaceTickish tickish |