Properly tag fun field of PAPs generated by ap_0_fast

Authored by osa1 on Aug 21 2018, 3:06 PM.

Description

Properly tag fun field of PAPs generated by ap_0_fast

Currently ap_0_fast doesn't maintain the invariant for PAP fun fields
which says if the closure can be tagged, it should be. This is checked
by Sanity.c:checkPAP and correctly implemented by genautoapply.

This causes sanity check failures when we have a profiling code like

f = {-# SCC scc #-} g

where g is a PAP or a FUN, and scc is different than the current cost
centre.

Test Plan: Slow validate (not done yet)

Reviewers: simonmar, bgamari, erikd

Reviewed By: simonmar

Subscribers: rwbarton, carter

GHC Trac Issues: Trac #15508

Differential Revision: https://phabricator.haskell.org/D5051