[commit: ghc] master: Fixup the new code layout patch for SplitObjs. (6c26b3f)

git at git.haskell.org git at git.haskell.org
Thu Nov 22 18:44:19 UTC 2018


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

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

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

commit 6c26b3f85dfdc87f1caa7f4dd7ab4fd7bbb9e922
Author: klebinger.andreas at gmx.at <klebinger.andreas at gmx.at>
Date:   Thu Nov 22 11:43:53 2018 -0500

    Fixup the new code layout patch for SplitObjs.
    
    When splitting objects we sometimes generate
    dummy CmmProcs containing bottom in some fields.
    
    Code introduced in the new code layout patch looked
    at these which blew up the compiler. Now we instead
    check first if the function actually contains code.
    
    Reviewers: bgamari
    
    Subscribers: simonpj, rwbarton, carter
    
    Differential Revision: https://phabricator.haskell.org/D5357


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

6c26b3f85dfdc87f1caa7f4dd7ab4fd7bbb9e922
 compiler/nativeGen/CFG.hs | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/compiler/nativeGen/CFG.hs b/compiler/nativeGen/CFG.hs
index a52c92f..8207859 100644
--- a/compiler/nativeGen/CFG.hs
+++ b/compiler/nativeGen/CFG.hs
@@ -481,9 +481,13 @@ addNodesBetween m updates =
 -}
 -- | Generate weights for a Cmm proc based on some simple heuristics.
 getCfgProc :: D.CfgWeights -> RawCmmDecl -> CFG
-getCfgProc _ (CmmData {}) = mapEmpty
-getCfgProc weights (CmmProc _info _lab _live graph) =
-  getCfg weights graph
+getCfgProc _       (CmmData {}) = mapEmpty
+-- Sometimes GHC generates dummy procs which don't actually contain code.
+-- But they might contain bottoms in some fields so we check for an empty
+-- body first. In particular this happens with SplitObjs enabled.
+getCfgProc weights (CmmProc _info _lab _live graph)
+  | null (toBlockList graph) = mapEmpty
+  | otherwise                = getCfg weights graph
 
 
 getCfg :: D.CfgWeights -> CmmGraph -> CFG



More information about the ghc-commits mailing list