cmm/CBE: Collapse blocks equivalent up to alpha renaming of local registers
authorBen Gamari <bgamari.foss@gmail.com>
Tue, 19 Sep 2017 20:57:41 +0000 (16:57 -0400)
committerBen Gamari <ben@smart-cactus.org>
Tue, 19 Sep 2017 20:57:43 +0000 (16:57 -0400)
commit7920a7d9c53083b234e060a3e72f00b601a46808
tree588a6af3c6320cf134aa21a386921c85cd6c70d2
parent3198956d371d1c16668b8131d1317b822f6c5cfe
cmm/CBE: Collapse blocks equivalent up to alpha renaming of local registers

As noted in #14226, the common block elimination pass currently
implements an extremely strict equivalence relation, demanding that two
blocks are equivalent including the names of their local registers. This
is quite restrictive and severely hampers the effectiveness of the pass.

Here we allow the CBE pass to collapse blocks which are equivalent up to
alpha renaming of locally-bound local registers. This is completely safe
and catches many more duplicate blocks.

Test Plan: Validate

Reviewers: austin, simonmar, michalt

Reviewed By: michalt

Subscribers: rwbarton, thomie

GHC Trac Issues: #14226

Differential Revision: https://phabricator.haskell.org/D3973
compiler/cmm/CmmCommonBlockElim.hs
compiler/cmm/Hoopl/Block.hs