
#14226: Common Block Elimination pass doesn't eliminate common blocks -------------------------------------+------------------------------------- Reporter: bgamari | Owner: bgamari Type: bug | Status: new Priority: high | Milestone: 8.6.1 Component: Compiler | Version: 8.2.1 (CodeGen) | Keywords: newcomer, Resolution: | CodeGen Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #9157, #14754 | Differential Rev(s): Phab:D3973, Wiki Page: | Phab:D3999 -------------------------------------+------------------------------------- Comment (by bgamari):
1) Fix the approach using alpha renaming by actually checking liveness on entry and exit for each variable. (to only consider variables that are not live across blocks) The disadvantage is that this would be quite a bit more costly.
2) Don't improve CBE itself, but run it a second time after the sinking
Right, I briefly considered implementing this. I don't expect it will be absurdly expensive: all we need to know is which variables are mentioned in only one block. However, I do wonder how much this will actually improve code. Presumably there are cases where this will be *too* conservative. pass - this might get rid of some of the cases from this ticket (e.g., the one from comment:6) The advantage is that this would also fix #12915; the disadvantage: this might not be always as effective as option 1). Mmm, interesting idea. This would certainly be worth a try. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14226#comment:29 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler