public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] df: Keep return address register undefined until epilogue_completed
@ 2016-08-29 16:50 Segher Boessenkool
  2016-08-29 20:20 ` Steven Bosscher
  2016-09-09 22:42 ` Jeff Law
  0 siblings, 2 replies; 9+ messages in thread
From: Segher Boessenkool @ 2016-08-29 16:50 UTC (permalink / raw)
  To: gcc-patches; +Cc: bonzini, seongbae.park, zadeck, Segher Boessenkool

For separate shrink-wrapping we need to find out which basic blocks
need what components set up by a prologue, so that we can move those
prologue pieces deeper into the function, so that those pieces are
executed less frequently, improving performance.

To do this, target code will normally look at the LIVE info: a block
needs a register set up if that register is in the IN, GEN, or KILL
sets.  This works fine for the callee-saved registers, since those
are not in entry_block_defs, but it does not work for the rs6000 link
register, because df_get_entry_block_def_set unconditinally adds the
register that is INCOMING_RETURN_ADDR_RTX (if it is a register).

This patch changes that so that that def is only added after
epilogue_completed.

With that, in the rs6000 backend we can use the same IN+GEN+KILL
condition to see whether LR is used (in the current patch set, only
KILL is used, which isn't correct; the backend can write to LR to
temporarily hold other values; a crazy idea, on modern hardware anyway,
but it does regardless).

Does this work on all other targets?  Should anything else be done?


Segher


2016-08-29  Segher Boessenkool  <segher@kernel.crashing.org>

	* df-scan.c (df_get_entry_block_def_set): Do not add the
	INCOMING_RETURN_ADDR_RTX register until epilogue_completed.

---
 gcc/df-scan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/df-scan.c b/gcc/df-scan.c
index 9cd647a..ea94f37 100644
--- a/gcc/df-scan.c
+++ b/gcc/df-scan.c
@@ -3567,7 +3567,7 @@ df_get_entry_block_def_set (bitmap entry_block_defs)
     }
 
 #ifdef INCOMING_RETURN_ADDR_RTX
-  if (REG_P (INCOMING_RETURN_ADDR_RTX))
+  if (REG_P (INCOMING_RETURN_ADDR_RTX) && epilogue_completed)
     bitmap_set_bit (entry_block_defs, REGNO (INCOMING_RETURN_ADDR_RTX));
 #endif
 
-- 
1.9.3

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

end of thread, other threads:[~2016-09-14 12:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-29 16:50 [PATCH] df: Keep return address register undefined until epilogue_completed Segher Boessenkool
2016-08-29 20:20 ` Steven Bosscher
2016-08-29 20:41   ` Segher Boessenkool
2016-09-09 22:51     ` Jeff Law
2016-09-09 22:35   ` Jeff Law
2016-09-09 22:42 ` Jeff Law
2016-09-10  8:03   ` Segher Boessenkool
2016-09-12 16:33     ` Jeff Law
2016-09-14 12:46       ` Segher Boessenkool

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).