public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] PR middle-end/67850: Wrong call_used_regs used in aggregate_value_p
@ 2015-10-06 11:43 H.J. Lu
  2015-10-06 12:31 ` Richard Biener
  0 siblings, 1 reply; 9+ messages in thread
From: H.J. Lu @ 2015-10-06 11:43 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jeff Law, Richard Biener

Since targetm.expand_to_rtl_hook may be called to switch ABI, it should
be called for each function before expanding to RTL.  Otherwise, we may
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
pass_expand::execute after RTL expansion starts.  We need to call
targetm.expand_to_rtl_hook early enough in cgraph_node::expand to make
sure that everything is in sync when RTL expansion starts.

Tested on Linux/x86-64.  OK for trunk?


H.J.
---
	PR middle-end/67850
	* cfgexpand.c (pass_expand::execute): Don't call
	targetm.expand_to_rtl_hook here.
	* cgraphunit.c (cgraph_node::expand): Call
	targetm.expand_to_rtl_hook here.
---
 gcc/cfgexpand.c  | 1 -
 gcc/cgraphunit.c | 3 +++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 58e55d2..6891750 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -6150,7 +6150,6 @@ pass_expand::execute (function *fun)
   /* Mark arrays indexed with non-constant indices with TREE_ADDRESSABLE.  */
   discover_nonconstant_array_refs ();
 
-  targetm.expand_to_rtl_hook ();
   crtl->stack_alignment_needed = STACK_BOUNDARY;
   crtl->max_used_stack_slot_alignment = STACK_BOUNDARY;
   crtl->stack_alignment_estimated = 0;
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 04a4d3f..537a089 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -1973,6 +1973,9 @@ cgraph_node::expand (void)
 
   bitmap_obstack_initialize (&reg_obstack); /* FIXME, only at RTL generation*/
 
+  /* It may update call_used_regs, which is used by aggregate_value_p.  */
+  targetm.expand_to_rtl_hook ();
+
   execute_all_ipa_transforms ();
 
   /* Perform all tree transforms and optimizations.  */
-- 
2.4.3

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-10-12 12:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-06 11:43 [PATCH] PR middle-end/67850: Wrong call_used_regs used in aggregate_value_p H.J. Lu
2015-10-06 12:31 ` Richard Biener
2015-10-06 13:30   ` [PATCH] PR target/67850: " H.J. Lu
2015-10-06 13:39     ` Richard Biener
2015-10-06 15:01       ` H.J. Lu
2015-10-06 17:09         ` H.J. Lu
2015-10-07  8:53           ` Richard Biener
2015-10-07  9:01             ` Uros Bizjak
2015-10-12 12:50               ` H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).