[PATCH ARM]: PR67745: Fix function alignment after __attribute__ 2/2

Christian Bruel christian.bruel@st.com
Thu Oct 1 07:12:00 GMT 2015



On 09/30/2015 09:02 PM, Jeff Law wrote:
> On 09/29/2015 07:24 AM, Christian Bruel wrote:
>> This patch uses FUNCTION_BOUNDARY instead of DECL_ALIGN to check the max
>> align when optimizing for size in assemble_start_function.
>> This is necessary for ARM that can switch the max code alignment
>> directives between modes.
>>
>> No regressions for ARM
>> Testing on-going for x86
>>
>> Christian
>>
>>
>> align2.patch
>>
>>
>> 2015-09-29  Christian Bruel<christian.bruel@st.com>
>>
>> 	PR target/67745
>> 	* gcc/varasm.c (assemble_start_function): Use current's function align.
> Does this override alignment information that might be attached to the 
> DECL?  

Yes. Well, in the backend, for architectural (ABI) defined alignment,
FUNCTION_BOUNDARY is used instead of DECL_ALIGN. And DECL_ALIGN is set
with FUNCTION_BOUNDARY (make_node_stat) so they are accidentally
equivalent if FUNCTION_BOUNDARY does not get changed due to switchable
target.

 Does that, in effect, override any alignment information that
> the developer may have put on the decl?  If so, then it seems like a bad 
> idea, even with -Os.

No it doesn't affect user alignments, that are carried thru
align_functions_log, that prevails over the DECL_ALIGN.
I played with various configurations of -falign-functions=x,
__attribute__((aligned(x))), optimization levels for arm and x86 and was
happy with them.

> 
> Am I missing something here?

Your comment makes me think about the direction I've taken to replace
DECL_ALIGN by FUNCTION_BOUNDARY, and the problem might not be user align
vs DECL_ALIGN: I stepped upon Jan's patch for a fortran regression.

2015-03-05  Jan Hubicka  <hubicka@ucw.cz>

	PR ipa/65334
	* cgraph.h (symtab_node): Add definition_alignment,

My patch was tested only for languages=c/c++. I'm going to give it a try
with Fortran.
If this is not satisfactory I'll have to think about updating DECL_ALIGN
after the function's attribute are processed and keep using it in
assemble_start_function.

Come back later

thanks,







More information about the Gcc-patches mailing list