summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorklebinger.andreas@gmx.at <klebinger.andreas@gmx.at>2018-11-22 11:43:53 -0500
committerBen Gamari <ben@smart-cactus.org>2018-11-22 12:11:16 -0500
commit6c26b3f85dfdc87f1caa7f4dd7ab4fd7bbb9e922 (patch)
tree96d34d194f08b8b8dcf633543d5af1338f4ee2a5 /compiler
parent67277e7c783dac1fb66d1b113a8b1f2be784b24b (diff)
downloadhaskell-6c26b3f85dfdc87f1caa7f4dd7ab4fd7bbb9e922.tar.gz
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
Diffstat (limited to 'compiler')
-rw-r--r--compiler/nativeGen/CFG.hs10
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler/nativeGen/CFG.hs b/compiler/nativeGen/CFG.hs
index a52c92f429..820785995e 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