This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RESEND: Patch to prevent combine abort on ppc-eabi


This patch has fallen through the cracks.  It prevents combine from
aborting on combine/structs.c and execute/950621-1.c on ppc-eabi
targets, only at -O1 (i.e. -fno-expensive-optimizations).  The bug
potentially affects any target that returns structs in registers.

Most of the credit goes to Richard Henderson, I just typed it in and
tested it.

Tested with C-only i386-linux -> powerpc-eabisim cross compiler, with
testsuite run.

zw

	* combine.c (record_dead_and_set_regs): Use
	regs_invalidated_by_call.  Don't note stores for CALL_INSNs.

===================================================================
Index: combine.c
--- combine.c	2001/12/12 05:58:12	1.245
+++ combine.c	2001/12/14 01:35:15
@@ -11202,7 +11202,7 @@ record_dead_and_set_regs (insn)
   if (GET_CODE (insn) == CALL_INSN)
     {
       for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
-	if (call_used_regs[i])
+	if (TEST_HARD_REG_BIT (regs_invalidated_by_call, i))
 	  {
 	    reg_last_set_value[i] = 0;
 	    reg_last_set_mode[i] = 0;
@@ -11212,6 +11212,13 @@ record_dead_and_set_regs (insn)
 	  }
 
       last_call_cuid = mem_last_set = INSN_CUID (insn);
+
+      /* Don't bother recording what this insn does.  It might set the
+	 return value register, but we can't combine into a call
+	 pattern anyway, so there's no point trying (and it may cause
+	 a crash, if e.g. we wind up asking for last_set_value of a
+	 SUBREG of the return value register).  */
+      return;
     }
 
   note_stores (PATTERN (insn), record_dead_and_set_regs_1, insn);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]