Don't eta-expand unsaturated primops
authorBen Gamari <ben@smart-cactus.org>
Fri, 21 Jun 2019 16:42:53 +0000 (12:42 -0400)
committerBen Gamari <ben@smart-cactus.org>
Wed, 26 Jun 2019 17:46:33 +0000 (13:46 -0400)
commit4d8a7206b3d8cf4be5084b49705e0a0db86e386b
treee00b19a812ebbd01a3f3a66526e42cbd88e01eed
parent9781903c83bf7ddc962db774973412fbb36e6f03
Don't eta-expand unsaturated primops

Previously, as described in Note [Primop wrappers], `hasNoBinding` would
return False in the case of `PrimOpId`s. This would result in eta
expansion of unsaturated primop applications during CorePrep. Not only
did this expansion result in unnecessary allocations, but it also meant
lead to rather nasty inconsistencies between the CAFfy-ness
determinations made by TidyPgm and CorePrep.

This fixes #16846.

(cherry picked from commit 4ae71eba8c1f680f3163fa27fd83cc5a5214770a)
compiler/basicTypes/Id.hs
compiler/basicTypes/Unique.hs
compiler/coreSyn/CorePrep.hs
compiler/main/TidyPgm.hs
compiler/prelude/PrelInfo.hs
compiler/prelude/PrelNames.hs
compiler/prelude/PrimOp.hs
compiler/stgSyn/CoreToStg.hs
testsuite/tests/codeGen/should_fail/T13233.hs
testsuite/tests/codeGen/should_fail/T13233.stderr