Don't enforce (normal) emission for pragma(inline, true) function templates, and don't cull lambdas (#3570)

With the new available_externally emission into each referencing CU, the
enforced regular emission from the module members tree shouldn't be
required anymore.

After adapting the codegen/inlining_templates.d lit-test accordingly (no
IR definitions anymore in .ll file, because available_externally doesn't
make it there), I've noticed that a lambda in imported and inlined
call_enforce_with_default_template_params() wasn't emitted - it got
culled by alreadyOrWillBeDefined().
Function/delegate literals aren't culled anymore.
This commit is contained in:
Martin Kinkelin 2020-09-30 21:26:26 +02:00 committed by GitHub
parent d33f6f9bbd
commit b1bd6fb2ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 27 deletions

View file

@ -371,28 +371,19 @@ public:
return;
}
// Force codegen if this is a templated function with pragma(inline, true).
if ((decl->members->length == 1) &&
((*decl->members)[0]->isFuncDeclaration()) &&
((*decl->members)[0]->isFuncDeclaration()->inlining == PINLINEalways)) {
Logger::println("needsCodegen() == false, but function is marked with "
"pragma(inline, true), so it really does need "
"codegen.");
} else {
// FIXME: This is #673 all over again.
if (!decl->needsCodegen()) {
Logger::println("Does not need codegen, skipping.");
return;
}
// FIXME: This is #673 all over again.
if (!decl->needsCodegen()) {
Logger::println("Does not need codegen, skipping.");
return;
}
if (irs->dcomputetarget && (decl->tempdecl == Type::rtinfo ||
decl->tempdecl == Type::rtinfoImpl)) {
// Emitting object.RTInfo(Impl) template instantiations in dcompute
// modules would require dcompute support for global variables.
Logger::println("Skipping object.RTInfo(Impl) template instantiations "
"in dcompute modules.");
return;
}
if (irs->dcomputetarget && (decl->tempdecl == Type::rtinfo ||
decl->tempdecl == Type::rtinfoImpl)) {
// Emitting object.RTInfo(Impl) template instantiations in dcompute
// modules would require dcompute support for global variables.
Logger::println("Skipping object.RTInfo(Impl) template instantiations "
"in dcompute modules.");
return;
}
for (auto &m : *decl->members) {