
#11649: LLVM code generator produces mal-formed LLVM blocks -------------------------------------+------------------------------------- Reporter: bgamari | Owner: erikd Type: bug | Status: closed Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 8.0.1-rc2 (CodeGen) | Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash | Test Case: Blocked By: | Blocking: Related Tickets: #9043 | Differential Rev(s): Phab:D1996 Wiki Page: | -------------------------------------+------------------------------------- Comment (by kavon): The entry block restriction isn't a bug in LLVM, it's just part of their IR design. I believe that not having any predecessors of the entry block simplifies some things related to computing dominators (plus, the way phi nodes work in LLVM makes it weird to write one for an entry block to merge incoming function arguments). A better fix for this issue would also include a way to avoid making a pass over the Cmm procedure to determine which global registers need allocas (which can only be declared in the entry block). Here's my proposal to solve both problems: For each CmmProc, after turning its Cmm blocks into LLVM blocks, we should generate a brand new entry basic block. This new entry block would include the allocas that we need for the function and then branch to the translated version of the original entry block. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11649#comment:16 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler