mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-08 11:56:12 +03:00
-linkonce-templates: Cull 'discardable' template instances (#3899)
Such instances are guaranteed not to need codegen (e.g., CTFE only).
This commit is contained in:
parent
c100c15ae0
commit
423a1d8270
2 changed files with 8 additions and 2 deletions
|
@ -318,8 +318,13 @@ public:
|
|||
return;
|
||||
}
|
||||
|
||||
// FIXME: This is #673 all over again.
|
||||
if (!global.params.linkonceTemplates && !decl->needsCodegen()) {
|
||||
// With -linkonce-templates, only non-speculative instances make it to
|
||||
// module members (see `TemplateInstance.appendToModuleMember()`), and we
|
||||
// don't need full needsCodegen() culling in that case; isDiscardable() is
|
||||
// sufficient. Speculative ones are lazily emitted if actually referenced
|
||||
// during codegen - per IR module.
|
||||
if ((global.params.linkonceTemplates && decl->isDiscardable()) ||
|
||||
(!global.params.linkonceTemplates && !decl->needsCodegen())) {
|
||||
Logger::println("Does not need codegen, skipping.");
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue