[GHC] #8275: Loopification breaks profiling

GHC ghc-devs at haskell.org
Fri Oct 18 12:31:07 UTC 2013


#8275: Loopification breaks profiling
----------------------------------------+----------------------------------
        Reporter:  jstolarek            |            Owner:  jstolarek
            Type:  bug                  |           Status:  new
        Priority:  high                 |        Milestone:  7.8.1
       Component:  Profiling            |          Version:  7.7
      Resolution:                       |         Keywords:
Operating System:  Unknown/Multiple     |     Architecture:
 Type of failure:  Building GHC failed  |  Unknown/Multiple
       Test Case:                       |       Difficulty:  Unknown
        Blocking:  8298                 |       Blocked By:  8456
                                        |  Related Tickets:
----------------------------------------+----------------------------------

Comment (by simonpj):

 About `CmmContFlowOpt`, it looks to me as if there may be other bugs.
 When deciding in `shouldConcatWith` whether the destination block is
 small, we look in `blocks`; but those are the original un-rewritten
 blocks, and we might have already rewritten the destination block.

 I think it might be better to consider this algorithm as something that
 rewrites a full graph to a graph (both represented as usual as a finite
 map).  The algorithm takes a post-order DFS list of block-ids (not
 blocks!) which is used as the list of blocks to consider, one by one.
 Look up that block id to find the block, consider whether to rewrite it;
 if so, rewrite it and replace it in the finite map, and move on to the
 next one.

 You are right that rewriting changes predecessor counts, so you'd need to
 maintain that alongside the current graph.  An easy approximiation would
 be this: keep a set of block-ids that are referenced exactly once, and
 delete things from it when necessary.  (But never add anything.)  That
 would be an approximation, but probably a reasonable one.

 I don't agree with Simon M that "not shortcut or concat backward jumps"
 will give results that are at least as good.  Imagine a backward goto to a
 goto!

 Thanks for working on this Jan

 Simon

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8275#comment:25>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list