🐛 Suboptimal temporary terms for external functions

If a given external function was called two times with different arguments,
then the second call would always be computed in the same temporary terms
chunk (derivation order or block) as the first call, even if this was not
necessary (technically, the second call would be promoted in the temporary
terms computation in the same category as the first call).

This could possibly lead to an inefficiency.
master
Sébastien Villemot 2023-03-23 17:58:49 +01:00
parent 712b11a045
commit f48a698458
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
1 changed files with 5 additions and 5 deletions

View File

@ -7570,7 +7570,7 @@ ExternalFunctionNode::sameTefTermPredicate() const
{
return [this](expr_t e) {
auto e2 = dynamic_cast<ExternalFunctionNode *>(e);
return (e2 != nullptr && e2->symb_id == symb_id);
return (e2 != nullptr && e2->symb_id == symb_id && e2->arguments == arguments);
};
}
@ -7900,12 +7900,12 @@ FirstDerivExternalFunctionNode::sameTefTermPredicate() const
if (first_deriv_symb_id == symb_id)
return [this](expr_t e) {
auto e2 = dynamic_cast<ExternalFunctionNode *>(e);
return (e2 && e2->symb_id == symb_id);
return (e2 && e2->symb_id == symb_id && e2->arguments == arguments);
};
else
return [this](expr_t e) {
auto e2 = dynamic_cast<FirstDerivExternalFunctionNode *>(e);
return (e2 && e2->symb_id == symb_id);
return (e2 && e2->symb_id == symb_id && e2->arguments == arguments);
};
}
@ -8244,12 +8244,12 @@ SecondDerivExternalFunctionNode::sameTefTermPredicate() const
if (second_deriv_symb_id == symb_id)
return [this](expr_t e) {
auto e2 = dynamic_cast<ExternalFunctionNode *>(e);
return (e2 && e2->symb_id == symb_id);
return (e2 && e2->symb_id == symb_id && e2->arguments == arguments);
};
else
return [this](expr_t e) {
auto e2 = dynamic_cast<SecondDerivExternalFunctionNode *>(e);
return (e2 && e2->symb_id == symb_id);
return (e2 && e2->symb_id == symb_id && e2->arguments == arguments);
};
}