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]

Avoid invalid sharing on HP-PA bootstrap


Hi,
folding of relationals introduce invalid sharing.  In this case the
secnario is as follows:

There is (ltu (subreg ...) (const_int)) test that actually simplify into
eq that is cheaper. fold_rtx however first looks for alternatives of
operands, it finds another copy of the very same subreg and produce (eq
(subreg ...) (const_int)) that is now having wrong sharing with
instruction producing that subregs.

This seems to be slightly misbehaving as it would be easier to first try
to simplify the relational itself and then look for alternatives, but it
looks like fold_rtx is consistenty designed this way (and if it picked
another operand just for the simplification, in next iteration it should
work out things correctly).

This patch fixes the sharing issue that is there anyway.

Bootstrapped/regtested i686-linux.  I am not sure if it solves all HP
problems, but at least gfortran/expr.o now compiles. OK?

Honza

	PR target/33318
	* cse.c (fold_rtx): Avoid invalid sharing.
Index: cse.c
===================================================================
--- cse.c	(revision 128145)
+++ cse.c	(working copy)
@@ -3246,7 +3247,8 @@ fold_rtx (rtx x, rtx insn)
 		      /* If we have a cheaper expression now, use that
 			 and try folding it further, from the top.  */
 		      if (cheapest_simplification != x)
-			return fold_rtx (cheapest_simplification, insn);
+			return fold_rtx (copy_rtx (cheapest_simplification),
+					 insn);
 		    }
 		}
 


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