This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PR 83990] Fix location handling in ipa_modify_call_arguments


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]