Hi,
On 10/14/25 18:21, Jakub Jelinek wrote:
On Tue, Oct 14, 2025 at 06:02:50PM +0200, Josef Melcr wrote:
The propagation is not considered profitable enough:
-----
Evaluating opportunities for main._omp_fn.0/1.
- considering value
1.3547000000000000152766688188421539962291717529296875e+0 for param #0
struct .omp_data_s.0 & restrict, offset: 0 (caller_count: 1)
good_cloning_opportunity_p (time: 1, size: 7, freq_sum: 1) ->
evaluation: 142.86, threshold: 500
good_cloning_opportunity_p (time: 1, size: 7, freq_sum: 1) ->
evaluation: 142.86, threshold: 500
-----
You only find this out if you toggle on the detailed ipa-cp dump. If you
add a loop large enough before entering the parallel region, the propagation
does take place, so something like:
Cost-wise, at least for the OpenMP/OpenACC constructs, it would be nice if
in the cost analysis it counted that while perhaps the caller happens just
once (is the problem solely with main or other functions too?), that the
callback will be called many times.
Yeah, that's a good idea. It might help mitigate some of the issues
with surpassing thresholds for propagation and also just make it more
accurate in general. Good point :)
Perhaps the GNU attribute could specify both?
Arguments 2, 4 would mean fnptr is 2nd argument and its 1st argument is 4th,
so foo (1, fn, 2, &s) calls fn (&s).
And 2, 6, 5, 4 means foo (1, fn, 2, &s, &t, &u) calls fn (&u, &t, &s).
0 is not a valid argument index, so that could be used as a separator to
where to map those arguments if not to 1-(nargs-1).
So, 2, 6, 5, 4, 0, 2, 4, 3 would mean foo (1, fn, 2, &s, &t, &u) calls
fn (?, &u, &s, &t).
I.e. 2, 4 would be equivalent to 2, 4, 0, 1 and 2, 6, 5, 4 equivalent
to 2, 6, 5, 4, 0, 1, 2, 3.
Is that necessary? Currently, 0 serves as a marker for an unknown
argument, the mapping is determined by the order. So fn (?, &u, &s, &t)
is 2, 0, 6, 5, 4; the call in qsort_r would be 4, 0, 0, 5 and so on. I
very well might be missing something, but I am not sure there is an
advantage to stating the mapping explicitly, which makes it in my
opinion less readable.
Jakub
Best regards,
Josef