On Mon, Feb 12, 2018 at 06:35:47PM +0100, Martin Jambor wrote:
> 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 <mjam...@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
> 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
> 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);