Fix faulty substitutions in StgCse (#11532).
authorklebinger.andreas@gmx.at <klebinger.andreas@gmx.at>
Tue, 2 Apr 2019 12:20:12 +0000 (14:20 +0200)
committerMarge Bot <ben+marge-bot@smart-cactus.org>
Wed, 3 Apr 2019 04:34:57 +0000 (00:34 -0400)
commit5a75ccd0993ff2fdf827824e28ae7db4ad9c25ad
treeefae16bdc9be651f85148a6ef68fc38d2664215b
parentbf73419518ca550e85188616f860961c7e2a336b
Fix faulty substitutions in StgCse (#11532).

`substBndr` should rename bindings which shadow existing ids.
However while it was renaming the bindings it was not adding proper substitutions
for renamed bindings.
Instead of adding a substitution of the form `old -> new` for renamed
bindings it mistakenly added `old -> old` if no replacement had taken
place while adding none if `old` had been renamed.

As a byproduct this should improve performance, as we no longer add
useless substitutions for unshadowed bindings.
compiler/simplStg/StgCse.hs