Opened 3 years ago

Closed 3 years ago

#12979 closed task (fixed)

-fspecialise-aggressively is not documented

Reported by: mpickering Owned by:
Priority: normal Milestone:
Component: Compiler Version: 8.0.1
Keywords: newcomer Cc: danharaj
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


I couldn't find any documentation for -fspecialise-aggressively. The flag is explained in compiler/specialise/Specialise in the note [Specialise imported INLINABLE things] but doesn't appear in the user manual!

The flag was introduced in b9e49d3e9580e13d89efd1f779cb76f610e0d6e0.

Change History (6)

comment:1 Changed 3 years ago by simonpj

It's entirely experimental; I was just trying something out, and didn't mean to advertise it. But by all means add a user-manual entry -- thanks!

comment:2 Changed 3 years ago by mpickering

I'm unsure what kind of code it is meant to specialise better. The ticket linked in the comment (#8874) is irrelevant.

Is it meant to specialise functions which are polymorphic but but not overloaded?

comment:3 Changed 3 years ago by danharaj

The relevant documentation seems to be:

Note [Specialise imported INLINABLE things]
What imported functions do we specialise?  The basic set is
 * DFuns and things with INLINABLE pragmas.
but with -fspecialise-aggressively we add
 * Anything with an unfolding template

Trac #8874 has a good example of why we want to auto-specialise DFuns.

We have the -fspecialise-aggressively flag (usually off), because we
risk lots of orphan modules from over-vigorous specialisation.
However it's not a big deal: anything non-recursive with an
unfolding-template will probably have been inlined already.

I have experimented with using this flag too, but it didn't do much for my use case beyond -fexpose-all-unfoldings and generous use of INLINABLE. As I understand it, instead I could use -fexpose-all-unfoldings and -fspecialise-aggressively and need not worry about putting INLINABLE annotations on my declarations. Is that correct?

By the way, it is really brutal on compilation times!

comment:4 Changed 3 years ago by mpickering

Yes that is right Dan.

Is the compilation time much worse than marking all your definitions as INLINABLE? I can't see what it would do more than that would.

comment:5 Changed 3 years ago by Ben Gamari <ben@…>

In a8c81f3/ghc:

Document -fspecialise-aggressively

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #12979

comment:6 Changed 3 years ago by mpickering

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.