This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PR 83990] Fix location handling in ipa_modify_call_arguments
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Martin Jambor <mjambor at suse dot cz>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 12 Feb 2018 18:37:51 +0100
- Subject: Re: [PR 83990] Fix location handling in ipa_modify_call_arguments
- Authentication-results: sourceware.org; auth=none
- References: <ri6vaf2xg98.fsf@suse.cz>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Mon, Feb 12, 2018 at 06:35:47PM +0100, Martin Jambor wrote:
> Hi,
>
> the callee-side arguments manipulation method used by IPA-SRA has two
> issues with how it deals with locations. First, it gets the location
> from expressions in an unreliable way rather than the statements it sees
> and then it forgets to set a location of one gimple assign it creates.
> Both is fixed in the patch below.
>
> I have bootstrapped and tested the patch on an x86_64-linux and consider
> it pre-approved by Jakub in bugzilla so plan to commit it to trunk
> tomorrow and to the gcc-7-branch soon afterwards (after testing there).
Yeah, this is ok.
> 2018-01-30 Martin Jambor <mjambor@suse.cz>
>
> PR c++/83990
> * ipa-param-manipulation.c (ipa_modify_call_arguments): Use location
> of call statements, also set location of a load to a temporary.
>
> --- a/gcc/ipa-param-manipulation.c
> +++ b/gcc/ipa-param-manipulation.c
> @@ -295,8 +295,7 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gcall *stmt,
>
> poly_int64 byte_offset = exact_div (adj->offset, BITS_PER_UNIT);
> base = gimple_call_arg (stmt, adj->base_index);
> - loc = DECL_P (base) ? DECL_SOURCE_LOCATION (base)
> - : EXPR_LOCATION (base);
> + loc = gimple_location (stmt);
>
> if (TREE_CODE (base) != ADDR_EXPR
> && POINTER_TYPE_P (TREE_TYPE (base)))
> @@ -385,6 +384,7 @@ ipa_modify_call_arguments (struct cgraph_edge *cs, gcall *stmt,
> else
> expr = create_tmp_reg (TREE_TYPE (expr));
> gimple_assign_set_lhs (tem, expr);
> + gimple_set_location (tem, loc);
> gsi_insert_before (&gsi, tem, GSI_SAME_STMT);
> }
> }
> --
> 2.15.1
Jakub