
#15124: Improve block layout for the NCG -------------------------------------+------------------------------------- Reporter: AndreasK | Owner: AndreasK Type: task | Status: new Priority: normal | Milestone: 8.6.1 Component: Compiler (NCG) | Version: 8.2.2 Resolution: | Keywords: CodeGen Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #8082 #14672 | Differential Rev(s): Phab:D4726 Wiki Page: | -------------------------------------+------------------------------------- Comment (by AndreasK): Replying to [comment:5 AndreasK]:
I've wrote up a patch implementing an experimental code layout algorithm, which hopefully is easy to adjust to take advantage of additional information about control flow.
Code is at Phab:D4726. As it stands:
* It works (only) on x64. * Performance is around the same. (Better but within the margin of error). * Compiler performance is slightly worse.
There are a lot of knobs to tune this approach further but verifying any results is tedious so I stopped eventually.
For now I hope to use this eventually as a substrate for the work on #14672.
I've also created a wiki page here https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/CodeLayout with more details.
I've came over a comment here: https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/Backends/NCG#Redun...
The allocator goes to considerable computational expense to construct all the flow edges in the group of instructions it's allocating for, by using the insnFuture function in the Instr pseudo-abstract type.
Since my patch already constructs and maintains a CFG maybe we can reuse this. Although currently it's on the basic block not instruction level and I haven't checked if the comment is still relevant either. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15124#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler