From 01fd26178f2c7ccbddbd66387e21f339cf9cda96 Mon Sep 17 00:00:00 2001 From: Matthew Pickering Date: Thu, 3 Jun 2021 23:04:13 +0100 Subject: profiling: Look in RHS of rules for cost centre ticks There are some obscure situations where the RHS of a rule can contain a tick which is not mentioned anywhere else in the program. If this happens you end up with an obscure linker error. The solution is quite simple, traverse the RHS of rules to also look for ticks. It turned out to be easier to implement if the traversal was moved into CoreTidy rather than at the start of code generation because there we still had easy access to the rules. ./StreamD.o(.text+0x1b9f2): error: undefined reference to 'StreamK_mkStreamFromStream_HPC_cc' ./MArray.o(.text+0xbe83): error: undefined reference to 'StreamK_mkStreamFromStream_HPC_cc' Main.o(.text+0x6fdb): error: undefined reference to 'StreamK_mkStreamFromStream_HPC_cc' --- compiler/GHC/Unit/Module/ModGuts.hs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'compiler/GHC/Unit/Module') diff --git a/compiler/GHC/Unit/Module/ModGuts.hs b/compiler/GHC/Unit/Module/ModGuts.hs index b40c980744..e799ebf2a1 100644 --- a/compiler/GHC/Unit/Module/ModGuts.hs +++ b/compiler/GHC/Unit/Module/ModGuts.hs @@ -34,6 +34,7 @@ import GHC.Types.Name.Reader import GHC.Types.SafeHaskell import GHC.Types.SourceFile ( HscSource(..), hscSourceToIsBoot ) import GHC.Types.SrcLoc +import GHC.Types.CostCentre -- | A ModGuts is carried through the compiler, accumulating stuff as it goes @@ -131,6 +132,7 @@ data CgGuts -- data constructor workers; reason: we regard them -- as part of the code-gen of tycons + cg_ccs :: [CostCentre], -- List of cost centres used in bindings and rules cg_foreign :: !ForeignStubs, -- ^ Foreign export stubs cg_foreign_files :: ![(ForeignSrcLang, FilePath)], cg_dep_pkgs :: ![UnitId], -- ^ Dependent packages, used to -- cgit v1.2.1