From: Michael D. Adams Date: Sun, 15 Jul 2007 16:20:03 +0000 (+0000) Subject: Keep the CPS pass from creating proc points due to unreachable parents. X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=ca9c90e51724d8efdebfd97128b21c5bc0eed555;p=ghc-hetmet.git Keep the CPS pass from creating proc points due to unreachable parents. The parser/flattener will generate an extra block after an if/else statement even if both branches exit the function. So it is possible for the input to the CPS pass to have dead/unreachable blocks. If a dead block goes to a live block then the live block would have more parents than the dead block and prior to this patch the live block would then be identified as a proc point. This is fixed by adding a check to see if the parent has at least one owner. --- diff --git a/compiler/cmm/CmmProcPoint.hs b/compiler/cmm/CmmProcPoint.hs index fe64608..df408c6 100644 --- a/compiler/cmm/CmmProcPoint.hs +++ b/compiler/cmm/CmmProcPoint.hs @@ -79,8 +79,12 @@ calculateNewProcPoints owners block = where parent_owners = lookupWithDefaultUFM owners emptyUniqSet parent_id child_owners = lookupWithDefaultUFM owners emptyUniqSet child_id - needs_proc_point = not $ isEmptyUniqSet $ - child_owners `minusUniqSet` parent_owners + needs_proc_point = + -- only if parent isn't dead + (not $ isEmptyUniqSet parent_owners) && + -- and only if child has more owners than parent + (not $ isEmptyUniqSet $ + child_owners `minusUniqSet` parent_owners) calculateOwnership :: BlockEnv BrokenBlock -> UniqSet BlockId