[FuncSpec] Fix missed opportunities for function specialisation
authorMomchil Velikov <momchil.velikov@arm.com>
Tue, 25 Oct 2022 18:53:41 +0000 (19:53 +0100)
committerMomchil Velikov <momchil.velikov@arm.com>
Tue, 25 Oct 2022 22:19:48 +0000 (23:19 +0100)
commit1a525dec7f3f82275517c130cf954d525cbf5e92
tree71d174751d39f0e1170016d74598befd1b535b87
parent2098e2f472578f793c565b669500dca454b4a608
[FuncSpec] Fix missed opportunities for function specialisation

When collecting the possible constant arguments to
specialise a function the compiler will abandon the search
on the first argument that is for some reason unsuitable as
a specialisation constant. Thus, depending on the traversal
order of the functions and call sites, the compiler can end
up with a different set of possible constants, hence with
different set of specialisations.

With this patch, the compiler will skip unsuitable
constants, but nevertheless will continue searching for
more.

Reviewed By: ChuanqiXu

Differential Revision: https://reviews.llvm.org/D135867
llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
llvm/test/Transforms/FunctionSpecialization/get-possible-constants.ll [new file with mode: 0644]