Fix PR rtl-optimization/91347

Message ID 2193458.IskpPayDMY@arcturus.home
State New
Headers show
  • Fix PR rtl-optimization/91347
Related show

Commit Message

Eric Botcazou Aug. 20, 2019, 9:17 a.m.
This is a regression present on all active branches: the compiler generates 
wrong code when tail cail optimization is used on the HPPA because the RTL DSE 
passes incorrectly deletes a live store.  The fix completes the previous fix 
by Jakub for PR rtl-opt/55023 by extending the treatment applied to some tail 
calls before reload to all tail calls if HARD_FRAME_POINTER_IS_ARG_POINTER.

Tested by Dave on HPPA/Linux, applied on all active branches.

2019-08-20  Eric Botcazou  <>

	PR rtl-optimization/91347
	* dse.c (scan_insn): Call add_wild_read for non-const/memset tail calls

2019-08-20  Eric Botcazou  <>

	* gcc.c-torture/execute/20190820-1.c: New test.

Eric Botcazou


Index: dse.c
--- dse.c	(revision 274487)
+++ dse.c	(working copy)
@@ -2537,10 +2537,13 @@  scan_insn (bb_info_t bb_info, rtx_insn *insn)
 		clear_rhs_from_active_local_stores ();
-      else if (SIBLING_CALL_P (insn) && reload_completed)
+      else if (SIBLING_CALL_P (insn)
+	       && (reload_completed || HARD_FRAME_POINTER_IS_ARG_POINTER))
 	/* Arguments for a sibling call that are pushed to memory are passed
 	   using the incoming argument pointer of the current function.  After
-	   reload that might be (and likely is) frame pointer based.  */
+	   reload that might be (and likely is) frame pointer based.  And, if
+	   it is a frame pointer on the target, even before reload we need to
+	   kill frame pointer based stores.  */
 	add_wild_read (bb_info);
 	/* Every other call, including pure functions, may read any memory