On Fri, Nov 18, 2016 at 2:38 AM, kugan
<kugan.vivekanandara...@linaro.org> wrote:
> Hi,
>
> I was relying on ipa_get_callee_param_type to get type of parameter and then
> convert arguments to this type while computing jump functions. However, in
> cases like shown in PR78365, ipa_get_callee_param_type, instead of giving
> up, would return the wrong type. I think the current uses of
> ipa_get_callee_param_type are fine with this.
>
> Attached patch now uses callee's DECL_ARGUMENTS to get the type. If it
> cannot be found, then I would give up and set the jump function to varying.
>
> Bootstrapped and regression tested on x86_64-linux-gnu with no new
> regressions. Is this OK for trunk?

I think a better fix for mismatches would be to record expected "source" types
in the jump functions themselves rather than trying to second-guess them.

If not then please fix ipa_get_callee_param_type -- DECL_ARGUMENTS
is indeed what we need to look at first to match the IL.  TYPE_ARG_TYPES
is merely a fallback (it doesn't have promotion applied -- see TREE_TYPE
vs. DECL_ARG_TYPE on the PARM_DECLs).

Richard.

> Thanks,
> Kugan
>
> gcc/testsuite/ChangeLog:
>
> 2016-11-18  Kugan Vivekanandarajah  <kug...@linaro.org>
>
>         PR IPA/78365
>         * gcc.dg/torture/pr78365.c: New test.
>
> gcc/ChangeLog:
>
> 2016-11-18  Kugan Vivekanandarajah  <kug...@linaro.org>
>
>         PR IPA/78365
>         * ipa-cp.c (propagate_constants_accross_call): get param type from
> callees
>         DECL_ARGUMENTS if available.
>         * ipa-prop.c (ipa_compute_jump_functions_for_edge): Likewise.
>         (ipcp_update_vr):  Remove now redundant conversion of precision for
> VR.
>         * ipa-prop.h: Make ipa_get_callee_param_type local again.

Reply via email to