Fix an old and egregious specialisation bug (Trac #5113)

The specialiser needs to know if a dictionay has some structure,
so that it can decide whether to specialise a function. Eg
 (A)    let d = $dfblah d1
        in ....(f d)....

 (B)    \d. ....(f d)....

In (A) it's probably worth specialising f; in (B) it isn't.
Previously we were relying on d's unfolding, but the specialiser
does cloning as it goes, which discards the unfolding. So we
were simply discarding all specialisations for functions with
local dictionary bindings!  This bug seems to have been there
for a long time.

This is what originally caused Trac #5113.  Then we went through a phase
where local bindings were not generalised, and that meant there was
no locally overloaded f to specialise; so the performance problem appeared
to be fixed.  But now we are generalising local bindings again, so it
re-appeared.

This patch fixes the original problem.
Merge branch 'master' of http://darcs.haskell.org/ghc
Extra comment about the fix to Trac #5113
Merge branch 'master' of http://darcs.haskell.org/ghc