Commit 6c26b3f8 authored by Andreas Klebinger's avatar Andreas Klebinger Committed by Ben Gamari

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:
parent 67277e7c
......@@ -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
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment