summaryrefslogtreecommitdiff
path: root/compiler/GHC/HsToCore/Pmc.hs
diff options
context:
space:
mode:
authorSebastian Graf <sebastian.graf@kit.edu>2021-08-17 18:50:25 +0200
committerSebastian Graf <sebastian.graf@kit.edu>2021-08-20 13:29:28 +0200
commit08f5ec098ce284a00c74e0b7f22d32374fac3155 (patch)
tree0ae20d22418bf0154fb805adc40375529cfddb3d /compiler/GHC/HsToCore/Pmc.hs
parentacb188e0c02a114927d340dac78a68626c659cd3 (diff)
downloadhaskell-wip/improve-pmc.tar.gz
Pmc: Better SCC annotations and trace outputwip/improve-pmc
While investigating #20106, I made a few refactorings to the pattern-match checker that I don't want to lose. Here are the changes: * Some key functions of the checker now have SCC annotations * Better `-ddump-ec-trace` diagnostics for easier debugging. I added 'traceWhenFailPm' to see *why* a particular `MaybeT` computation fails and made use of it in `instCon`. I also increased the acceptance threshold of T11545, which seems to fail randomly lately due to ghc/max flukes.
Diffstat (limited to 'compiler/GHC/HsToCore/Pmc.hs')
-rw-r--r--compiler/GHC/HsToCore/Pmc.hs10
1 files changed, 6 insertions, 4 deletions
diff --git a/compiler/GHC/HsToCore/Pmc.hs b/compiler/GHC/HsToCore/Pmc.hs
index 04236d54b9..0b2ef7f8cb 100644
--- a/compiler/GHC/HsToCore/Pmc.hs
+++ b/compiler/GHC/HsToCore/Pmc.hs
@@ -150,7 +150,7 @@ pmcMatches
-> [LMatch GhcTc (LHsExpr GhcTc)] -- ^ List of matches
-> DsM [(Nablas, NonEmpty Nablas)] -- ^ One covered 'Nablas' per Match and
-- GRHS, for long distance info.
-pmcMatches ctxt vars matches = do
+pmcMatches ctxt vars matches = {-# SCC "pmcMatches" #-} do
-- We have to force @missing@ before printing out the trace message,
-- otherwise we get interleaved output from the solver. This function
-- should be strict in @missing@ anyway!
@@ -169,10 +169,12 @@ pmcMatches ctxt vars matches = do
formatReportWarnings cirbsEmptyCase ctxt vars result
return []
Just matches -> do
- matches <- noCheckDs $ desugarMatches vars matches
- result <- unCA (checkMatchGroup matches) missing
+ matches <- {-# SCC "desugarMatches" #-}
+ noCheckDs $ desugarMatches vars matches
+ result <- {-# SCC "checkMatchGroup" #-}
+ unCA (checkMatchGroup matches) missing
tracePm "}: " (ppr (cr_uncov result))
- formatReportWarnings cirbsMatchGroup ctxt vars result
+ {-# SCC "formatReportWarnings" #-} formatReportWarnings cirbsMatchGroup ctxt vars result
return (NE.toList (ldiMatchGroup (cr_ret result)))
{- Note [pmcPatBind only checks PatBindRhs]