aggregate_value_p may be called: #0 aggregate_value_p (exp=0x7ffff7ff9258, fntype=0x7ffff150b0a8) at /export/gnu/import/git/sources/gcc/gcc/function.c:2096 #1 0x0000000000e2d3ae in (anonymous namespace)::pass_nrv::execute ( this=0x2313730, fun=0x7ffff16091f8) at /export/gnu/import/git/sources/gcc/gcc/tree-nrv.c:153 #2 0x0000000000c6c6ce in execute_one_pass (pass=0x2313730) at /export/gnu/import/git/sources/gcc/gcc/passes.c:2342 #3 0x0000000000c6c918 in execute_pass_list_1 (pass=0x2313730) at /export/gnu/import/git/sources/gcc/gcc/passes.c:2395 #4 0x0000000000c6c989 in execute_pass_list (fn=0x7ffff16091f8, pass=0x2310730) at /export/gnu/import/git/sources/gcc/gcc/passes.c:2406 #5 0x00000000008f436c in cgraph_node::expand (this=0x7ffff160c170) at /export/gnu/import/git/sources/gcc/gcc/cgraphunit.c:1983 #6 0x00000000008f49a6 in expand_all_functions () at /export/gnu/import/git/sources/gcc/gcc/cgraphunit.c:2119 #7 0x00000000008f54bf in symbol_table::compile (this=0x7ffff14e90a8) at /export/gnu/import/git/sources/gcc/gcc/cgraphunit.c:2472 #8 0x00000000008f56e0 in symbol_table::finalize_compilation_unit ( this=0x7ffff14e90a8) at /export/gnu/import/git/sources/gcc/gcc/cgraphunit.c:2562 #9 0x0000000000d6a287 in compile_file () (gdb) f 1 #1 0x0000000000e2d3ae in (anonymous namespace)::pass_nrv::execute ( this=0x2313730, fun=0x7ffff16091f8) at /export/gnu/import/git/sources/gcc/gcc/tree-nrv.c:153 153 if (!aggregate_value_p (result, current_function_decl)) (gdb) But the wrong call_used_regs may be used here: regno = REGNO (reg); nregs = hard_regno_nregs[regno][TYPE_MODE (type)]; for (i = 0; i < nregs; i++) if (! call_used_regs[regno + i]) return 1; since targetm.expand_to_rtl_hook may be called to switch ABI: (gdb) bt #0 ix86_maybe_switch_abi () at /export/gnu/import/git/sources/gcc/gcc/config/i386/i386.c:7445 #1 0x00000000008b0e6f in (anonymous namespace)::pass_expand::execute ( this=0x2313850, fun=0x7ffff16090a8) at /export/gnu/import/git/sources/gcc/gcc/cfgexpand.c:6153 #2 0x0000000000c6c6ce in execute_one_pass (pass=0x2313850) at /export/gnu/import/git/sources/gcc/gcc/passes.c:2342 #3 0x0000000000c6c918 in execute_pass_list_1 (pass=0x2313850) at /export/gnu/import/git/sources/gcc/gcc/passes.c:2395 #4 0x0000000000c6c989 in execute_pass_list (fn=0x7ffff16090a8, pass=0x2310730) at /export/gnu/import/git/sources/gcc/gcc/passes.c:2406 #5 0x00000000008f436c in cgraph_node::expand (this=0x7ffff160c000) at /export/gnu/import/git/sources/gcc/gcc/cgraphunit.c:1983 #6 0x00000000008f49a6 in expand_all_functions () at /export/gnu/import/git/sources/gcc/gcc/cgraphunit.c:2119 #7 0x00000000008f54bf in symbol_table::compile (this=0x7ffff14e90a8) at /export/gnu/import/git/sources/gcc/gcc/cgraphunit.c:2472 #8 0x00000000008f56e0 in symbol_table::finalize_compilation_unit ( this=0x7ffff14e90a8) at /export/gnu/import/git/sources/gcc/gcc/cgraphunit.c:2562 #9 0x0000000000d6a287 in compile_file () to change call_used_regs.
Should targetm.expand_to_rtl_hook be called from cgraph_node::expand instead?
Author: hjl Date: Wed Oct 7 10:30:12 2015 New Revision: 228565 URL: https://gcc.gnu.org/viewcvs?rev=228565&root=gcc&view=rev Log: Merge ix86_maybe_switch_abi with ix86_set_current_function ix86_maybe_switch_abi is called to late during RTL expansion and we use the stale information from compilation of the previous function. aggregate_value_p uses call_used_regs. aggregate_value_p is used by IPA and return value optimization, which are called before ix86_maybe_switch_abi is called. This patch merges ix86_maybe_switch_abi with ix86_set_current_function. PR target/67850 * config/i386/i386.c (ix86_maybe_switch_abi): Merged with ... (ix86_set_current_function): This. (TARGET_EXPAND_TO_RTL_HOOK): Removed. Modified: trunk/gcc/ChangeLog trunk/gcc/config/i386/i386.c
Author: hjl Date: Mon Oct 12 12:26:09 2015 New Revision: 228711 URL: https://gcc.gnu.org/viewcvs?rev=228711&root=gcc&view=rev Log: Merge ix86_maybe_switch_abi with ix86_set_current_function ix86_maybe_switch_abi is called to late during RTL expansion and we use the stale information from compilation of the previous function. aggregate_value_p uses call_used_regs. aggregate_value_p is used by IPA and return value optimization, which are called before ix86_maybe_switch_abi is called. This patch merges ix86_maybe_switch_abi with ix86_set_current_function. Backport from mainline: PR target/67850 * config/i386/i386.c (ix86_maybe_switch_abi): Merged with ... (ix86_set_current_function): This. (TARGET_EXPAND_TO_RTL_HOOK): Removed. Modified: branches/gcc-5-branch/gcc/ChangeLog branches/gcc-5-branch/gcc/config/i386/i386.c
Fixed for 5.3 and 6. No plan to backpor it to 4.9.