This is the mail archive of the gcc@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]

Re: 3.0.1 Freeze


Hi,

On Wed, 8 Aug 2001, Richard Henderson wrote:

> This patch looks like it "fixes" things by disabling the optimization.
> I think your earlier patch that looked at reg notes was more correct.

That change still missed other cases I tried. The basic problem is that
regmove_optimize doesn't handle multiple sets correctly. An input value
might be also used as unused output value and the tests there miss some
cases.
While thinking about it my patch might miss a correct optimization for
something like this:

(set (reg (1)) (... (reg (2) "0") ... (reg (1)) ...))

So the correct patch should possibly look like below, which also had the
advantage to handle multiple sets.
Should I test this version for the trunk and provide m68k only version of
the other patch for the branch?

bye, Roman

Index: regmove.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/regmove.c,v
retrieving revision 1.109
diff -u -r1.109 regmove.c
--- regmove.c	2001/07/26 15:23:07	1.109
+++ regmove.c	2001/08/08 18:48:14
@@ -1315,10 +1315,14 @@
 		    continue;
 		}

-	      set = single_set (insn);
+	      set = set_of (dst, insn);
 	      if (! set)
 		continue;

+	      /* src must not be the destination in another set. */
+	      if (set_of (src, insn))
+		continue;
+
 	      /* match_no/dst must be a write-only operand, and
 		 operand_operand/src must be a read-only operand.  */
 	      if (match.use[op_no] != READ
@@ -1330,7 +1334,7 @@
 		continue;

 	      /* Make sure match_no is the destination.  */
-	      if (recog_data.operand[match_no] != SET_DEST (set))
+	      if (GET_CODE (set) != SET || dst != SET_DEST (set))
 		continue;

 	      if (REGNO (src) < FIRST_PSEUDO_REGISTER)


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