This will consider function specialization for candidate constants in a
constant range where the range represents all the possible arguments.
Currently, this will only happen when
-function-specialization-for-literal-constant is supplied.
Arguments from calls that are constant ranges themselves are still
unsupported.
I have a feeling I might be missing something here. Is there a reason why this wasn't already the case?
Tests affected (function-specialization.NumFuncSpecialized)
test | before | after |
MultiSource/Applications/SPASS/SPASS.test | NaN | 11.00 |
MultiSource/Applications/JM/ldecod/ldecod.test | NaN | 3.00 |
MultiSource/Applications/oggenc/oggenc.test | 2.00 | 3.00 |
I tried measuring performance (Cycles/Instructions) with perf on x86, but there was too much noise in the results to gather anything meaningful.
Looking into the specialisations themselves, it often looks good. For some it introduces inlining opportunities. However, whether or not these were objectively good changes should be handled by the cost analysis. This change simply considers more opportunities.
My personal feeling is that FuncSpec might be able to replace IPSCCP completely if FuncSpec is ready enough. I tried to remove the whole check here in downstream and didn't see any regression in performance. (I didn't measure compile time though).