X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fprofiling%2FCostCentre.lhs;h=dc93a1fcbb5e2bf8605b23ac0c996cb81d79c94b;hb=8b683ed0e271c03f527b99d9152a4ccb55ff34dc;hp=4d13f102d2e9df909439d097843dc8ee8d13894d;hpb=3fc64886b53d4c0c6bd9731a04ed14a1d481d387;p=ghc-hetmet.git diff --git a/compiler/profiling/CostCentre.lhs b/compiler/profiling/CostCentre.lhs index 4d13f10..dc93a1f 100644 --- a/compiler/profiling/CostCentre.lhs +++ b/compiler/profiling/CostCentre.lhs @@ -39,6 +39,7 @@ module CostCentre ( import Var ( Id ) import Name import Module ( Module ) +import Unique import Outputable import FastTypes import FastString @@ -226,12 +227,14 @@ mkAutoCC id mod is_caf } where name = getName id - -- beware: we might be making an auto CC for a compiler-generated - -- thing (like a CAF when -caf-all is on), so include the uniq. - -- See bug #249, tests prof001, prof002 - str | isSystemName name = mkFastString (showSDoc (ppr name)) - | otherwise = occNameFS (getOccName id) - + -- beware: only external names are guaranteed to have unique + -- Occnames. If the name is not external, we must append its + -- Unique. + -- See bug #249, tests prof001, prof002, also #2411 + str | isExternalName name = occNameFS (getOccName id) + | otherwise = mkFastString $ showSDoc $ + ftext (occNameFS (getOccName id)) + <> char '_' <> pprUnique (getUnique name) mkAllCafsCC :: Module -> CostCentre mkAllCafsCC m = AllCafsCC { cc_mod = m }