diff options
author | Ben Gamari <ben@smart-cactus.org> | 2019-12-26 16:18:44 -0500 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-12-30 06:52:45 -0500 |
commit | 613f7265c7985b779877e6897118c53d5a333f10 (patch) | |
tree | 2a8540c3ff7181a8b2ac604c3efecdf957d8f63a /compiler | |
parent | b426de376e278af5fb7a8ce0ef7b1e245847c662 (diff) | |
download | haskell-613f7265c7985b779877e6897118c53d5a333f10.tar.gz |
llvmGen: Drop old fix for #11649
This was a hack which is no longer necessary now since we introduce a
dedicated entry block for each procedure.
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/llvmGen/LlvmCodeGen.hs | 37 |
1 files changed, 1 insertions, 36 deletions
diff --git a/compiler/llvmGen/LlvmCodeGen.hs b/compiler/llvmGen/LlvmCodeGen.hs index 5b37f83ee6..0fc7e76e58 100644 --- a/compiler/llvmGen/LlvmCodeGen.hs +++ b/compiler/llvmGen/LlvmCodeGen.hs @@ -17,11 +17,8 @@ import LlvmCodeGen.Ppr import LlvmCodeGen.Regs import LlvmMangler -import BlockId import GHC.StgToCmm.CgUtils ( fixStgRegisters ) import Cmm -import CmmUtils -import Hoopl.Block import Hoopl.Collections import PprCmm @@ -31,7 +28,6 @@ import GHC.Platform ( platformArch, Arch(..) ) import ErrUtils import FastString import Outputable -import UniqSupply import SysTools ( figureLlvmVersion ) import qualified Stream @@ -150,44 +146,13 @@ cmmDataLlvmGens statics renderLlvm $ pprLlvmData (concat gss', concat tss) --- | LLVM can't handle entry blocks which loop back to themselves (could be --- seen as an LLVM bug) so we rearrange the code to keep the original entry --- label which branches to a newly generated second label that branches back --- to itself. See: #11649 -fixBottom :: RawCmmDecl -> LlvmM RawCmmDecl -fixBottom cp@(CmmProc hdr entry_lbl live g) = - maybe (pure cp) fix_block $ mapLookup (g_entry g) blk_map - where - blk_map = toBlockMap g - - fix_block :: CmmBlock -> LlvmM RawCmmDecl - fix_block blk - | (CmmEntry e_lbl tickscp, middle, CmmBranch b_lbl) <- blockSplit blk - , isEmptyBlock middle - , e_lbl == b_lbl = do - new_lbl <- mkBlockId <$> getUniqueM - - let fst_blk = - BlockCC (CmmEntry e_lbl tickscp) BNil (CmmBranch new_lbl) - snd_blk = - BlockCC (CmmEntry new_lbl tickscp) BNil (CmmBranch new_lbl) - - pure . CmmProc hdr entry_lbl live . ofBlockMap (g_entry g) - $ mapFromList [(e_lbl, fst_blk), (new_lbl, snd_blk)] - - fix_block _ = pure cp - -fixBottom rcd = pure rcd - -- | Complete LLVM code generation phase for a single top-level chunk of Cmm. cmmLlvmGen ::RawCmmDecl -> LlvmM () cmmLlvmGen cmm@CmmProc{} = do -- rewrite assignments to global regs dflags <- getDynFlag id - fixed_cmm <- fixBottom $ - {-# SCC "llvm_fix_regs" #-} - fixStgRegisters dflags cmm + let fixed_cmm = {-# SCC "llvm_fix_regs" #-} fixStgRegisters dflags cmm dumpIfSetLlvm Opt_D_dump_opt_cmm "Optimised Cmm" FormatCMM (pprCmmGroup [fixed_cmm]) |