[PATCH] Avoid setting TREE_ADDRESSABLE on stack vars during RTL expansion
Richard Sandiford
richard.sandiford@arm.com
Tue May 18 09:58:06 GMT 2021
Richard Biener <rguenther@suse.de> writes:
> @@ -6621,9 +6637,31 @@ pass_expand::execute (function *fun)
> (int) param_ssp_buffer_size);
> }
>
> + /* Temporarily mark PARM_DECLs and RESULT_DECLs we need to expand to
> + memory addressable so expand_function_start can emit the required
> + copies. */
> + for (tree parm = DECL_ARGUMENTS (current_function_decl); parm;
> + parm = DECL_CHAIN (parm))
> + if (bitmap_bit_p (forced_stack_vars, DECL_UID (parm)))
> + TREE_ADDRESSABLE (parm) = 1;
> + if (DECL_RESULT (current_function_decl)
> + && bitmap_bit_p (forced_stack_vars,
> + DECL_UID (DECL_RESULT (current_function_decl))))
> + TREE_ADDRESSABLE (DECL_RESULT (current_function_decl)) = 1;
> +
> /* Set up parameters and prepare for return, for the function. */
> expand_function_start (current_function_decl);
>
> + /* Clear TREE_ADDRESSABLE again. */
> + for (tree parm = DECL_ARGUMENTS (current_function_decl); parm;
> + parm = DECL_CHAIN (parm))
> + if (bitmap_bit_p (forced_stack_vars, DECL_UID (parm)))
> + TREE_ADDRESSABLE (parm) = 0;
> + if (DECL_RESULT (current_function_decl)
> + && bitmap_bit_p (forced_stack_vars,
> + DECL_UID (DECL_RESULT (current_function_decl))))
> + TREE_ADDRESSABLE (DECL_RESULT (current_function_decl)) = 0;
> +
> /* If we emitted any instructions for setting up the variables,
> emit them before the FUNCTION_START note. */
> if (var_seq)
Is TREE_ADDRESSABLE guaranteed to be 0 for these decls before the code
is hit? I was surprised that we didn't need to protect against net
1->0 transitions.
Thanks,
Richard
More information about the Gcc-patches
mailing list