This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PR78365] ICE in determine_value_range, at tree-ssa-loo p-niter.c:413
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: kugan <kugan dot vivekanandarajah at linaro dot org>, Jan Hubicka <hubicka at ucw dot cz>, Richard Biener <richard dot guenther at gmail dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 24 Nov 2016 09:48:13 +0100
- Subject: Re: [PR78365] ICE in determine_value_range, at tree-ssa-loo p-niter.c:413
- Authentication-results: sourceware.org; auth=none
- References: <68396c67-fdcc-33ed-5463-a07502959865@linaro.org> <20161123153317.wjyjxgp6ltg5cp6t@virgil.suse.cz>
On Wed, Nov 23, 2016 at 4:33 PM, Martin Jambor <mjambor@suse.cz> wrote:
> Hi,
>
> On Fri, Nov 18, 2016 at 12:38:18PM +1100, kugan 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.
>
> At what stage does this happen? During analysis
> (ipa_compute_jump_functions_for_edge) or at WPA
> (propagate_constants_accross_call)? Both?
Hmm, where does jump function compute require the callee type?
In my view the jump function should record
(expected-incoming-type) arg [OP X]
for each call argument in its body. Thus required conversions are
done at WPA propagation time.
>> 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.
>
> But DECL_ARGUMENTS is not available at WPA stage with LTO so your
> patch would make our IPA layer to optimize less with LTO. This was
> the reason to go through the hoops of TYPE_ARG_TYPES in the first
> place.
>
> If TYPE_ARG_TYPES cannot be trusted, then I'm afraid we are back to
> square one and indeed need to put the correct type in jump functions.
If DECL_ARGUMENTS is not available at WPA stage then I see no other
way than to put the types on the jump functions.
> If just preferring DECL_ARGUMENTS is enough, then changing
> ipa_get_callee_param_type to use that if is is available, as Richi
> suggested, would indeed be preferable. But if even falling back on it
> can cause errors, then I am not sure if it helps.
>
> In any event, thanks for diligently dealing with the fallout,
>
> Martin
>
>
>>
>> Bootstrapped and regression tested on x86_64-linux-gnu with no new
>> regressions. Is this OK for trunk?
>>
>> Thanks,
>> Kugan
>>
>> gcc/testsuite/ChangeLog:
>>
>> 2016-11-18 Kugan Vivekanandarajah <kuganv@linaro.org>
>>
>> PR IPA/78365
>> * gcc.dg/torture/pr78365.c: New test.
>>
>> gcc/ChangeLog:
>>
>> 2016-11-18 Kugan Vivekanandarajah <kuganv@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.