Hi,

On 10/15/25 11:19, Jan Hubicka wrote:
Note that current ipa-cp implementation at -O2 will happily propagate in
cases which needs no cloning controlled by -fipa-cp-clone.  So making it
to also propagate into openMP kernels provided that doing so needs to
code duplication is consistent with current implementation.
How strict is this policy?  In the OpenMP case, each parallel region has its own callback, which means that after cloning and edge redirection, the original callback can be removed from the code altogether.  The code would be duplicated during compilation, but the resulting binary would only contain the optimized clone.
For normal cloning we use node->local flag that tests that all calls to
the function are under our control (function is only called directly,
not exported and has no address taken).

We need to compute equivalent of this flag for kernels which is not too
hard.  We only want to check that the kernel is not called directly, not
exported and all calls are those having callback attribute on them.
That doesn't sound too difficult.  It shouldn't even be hard to maintain, as all the info affecting it should be in the current TU, if I am not mistaken.
Honza

Best regards,

Josef

Reply via email to