[commit: ghc] master: Drop proc-points that don't exist in the graph (#8205) (bec3c04)

git at git.haskell.org git at git.haskell.org
Wed Sep 11 15:34:04 CEST 2013


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/bec3c0497fa55e84005d175e0fc6b1d72df961e1/ghc

>---------------------------------------------------------------

commit bec3c0497fa55e84005d175e0fc6b1d72df961e1
Author: Jan Stolarek <jan.stolarek at p.lodz.pl>
Date:   Wed Sep 11 12:17:10 2013 +0100

    Drop proc-points that don't exist in the graph (#8205)
    
    On some architectures it might happen that stack layout pass will
    invalidate the list of calculated procpoints by dropping some of
    them. We fix this by checking whether a proc-point is in a graph
    at the beginning of proc-point analysis. This is a speculative
    fix for #8205.


>---------------------------------------------------------------

bec3c0497fa55e84005d175e0fc6b1d72df961e1
 compiler/cmm/CmmProcPoint.hs |   36 +++++++++++++++++++++++++++++++++---
 1 file changed, 33 insertions(+), 3 deletions(-)

diff --git a/compiler/cmm/CmmProcPoint.hs b/compiler/cmm/CmmProcPoint.hs
index c0dd0e1..5f9c27f 100644
--- a/compiler/cmm/CmmProcPoint.hs
+++ b/compiler/cmm/CmmProcPoint.hs
@@ -83,6 +83,33 @@ most once per iteration, then recompute the reachability information.
 arbitrary, and I don't know if the choice affects the final solution,
 so I don't know if the number of proc points chosen is the
 minimum---but the set will be minimal.
+
+
+
+Note [Proc-point analysis]
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Given a specified set of proc-points (a set of block-ids), "proc-point
+analysis" figures out, for every block, which proc-point it belongs to.
+All the blocks belonging to proc-point P will constitute a single
+top-level C procedure.
+
+A non-proc-point block B "belongs to" a proc-point P iff B is
+reachable from P without going through another proc-point.
+
+Invariant: a block B should belong to at most one proc-point; if it
+belongs to two, that's a bug.
+
+Note [Non-existing proc-points]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+On some architectures it might happen that the list of proc-points
+computed before stack layout pass will be invalidated by the stack
+layout. This will happen if stack layout removes from the graph
+blocks that were determined to be proc-points. Later on in the pipeline
+we use list of proc-points to perform [Proc-point analysis], but
+if a proc-point does not exist anymore then we will get compiler panic.
+See #8205.
 -}
 
 type ProcPointSet = BlockSet
@@ -104,11 +131,14 @@ instance Outputable Status where
 procPointAnalysis :: ProcPointSet -> CmmGraph -> UniqSM (BlockEnv Status)
 -- Once you know what the proc-points are, figure out
 -- what proc-points each block is reachable from
-procPointAnalysis procPoints g =
+-- See Note [Proc-point analysis]
+procPointAnalysis procPoints g@(CmmGraph {g_graph = graph}) =
   -- pprTrace "procPointAnalysis" (ppr procPoints) $
   dataflowAnalFwdBlocks g initProcPoints $ analFwd lattice forward
-  where initProcPoints = [(id, ProcPoint) | id <- setElems procPoints]
-
+  where initProcPoints = [(id, ProcPoint) | id <- setElems procPoints,
+                                            id `setMember` labelsInGraph ]
+                                    -- See Note [Non-existing proc-points]
+        labelsInGraph  = labelsDefined graph
 -- transfer equations
 
 forward :: FwdTransfer CmmNode Status




More information about the ghc-commits mailing list