Opened 4 years ago

Last modified 3 years ago

#11668 new bug

SPEC has a runtime cost if constructor specialization isn't performed

Reported by: bgamari Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.10.3
Keywords: SpecConstr Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Runtime performance bug Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


As far as I know, SPEC is merely intended to help the compiler identify calls for which constructor specialization may be help. Yet it's not erased! In fact, it has a runtime representation which we need to construct and pass around to so-marked calls. This likely isn't killing the performance of anyone's programs but surely we can do better than this.

Really, the whole scheme of marking functions with SPEC (which as far as I know isn't even properly documented) seems quite odd. What is stopping us from simply attaching pragmas to equations?

Change History (3)

comment:1 Changed 4 years ago by bgamari

Summary: SPEC has a runtime costSPEC has a runtime cost if constructor specialization isn't performed

It seems that SPEC is correctly eliminated if -fspec-constr is used so this should only be a problem for code expecting constructor specialization that gets compiled with -O1.

comment:2 Changed 4 years ago by simonpj

See Note [Forcing specialisation] in SpecConstr. The whole SPEC or ForceSpecConstr business (to force specialisation) is very unsatisfactory. It's just awaiting some bright person to have a better idea.

comment:3 Changed 3 years ago by simonpj

Keywords: SpecConstr added
Note: See TracTickets for help on using tickets.