From: Jakub Jelinek Date: Fri, 30 Aug 2019 11:19:17 +0000 (+0200) Subject: backport: re PR target/85593 (GCC on ARM allocates R3 for local variable when calling... X-Git-Tag: releases/gcc-7.5.0~284 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=19dfbd5380e08645f4cf3d26fa38c7a04e242035;p=thirdparty%2Fgcc.git backport: re PR target/85593 (GCC on ARM allocates R3 for local variable when calling naked function with O2 optimizations enabled) Backported from mainline 2018-12-07 Jakub Jelinek PR target/85593 * final.c (rest_of_handle_final): Don't call collect_fn_hard_reg_usage for functions with naked attribute. From-SVN: r275077 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 131276bcf50b..434031d876d0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,12 @@ 2019-08-30 Jakub Jelinek Backported from mainline + 2018-12-07 Jakub Jelinek + + PR target/85593 + * final.c (rest_of_handle_final): Don't call collect_fn_hard_reg_usage + for functions with naked attribute. + 2018-11-20 Jakub Jelinek PR tree-optimization/87895 diff --git a/gcc/final.c b/gcc/final.c index c3023285c216..43743f05d847 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -4490,7 +4490,11 @@ rest_of_handle_final (void) assemble_start_function (current_function_decl, fnname); final_start_function (get_insns (), asm_out_file, optimize); final (get_insns (), asm_out_file, optimize); - if (flag_ipa_ra) + if (flag_ipa_ra + /* Functions with naked attributes are supported only with basic asm + statements in the body, thus for supported use cases the information + on clobbered registers is not available. */ + && !lookup_attribute ("naked", DECL_ATTRIBUTES (current_function_decl))) collect_fn_hard_reg_usage (); final_end_function ();