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

[PATCH]: Fix PR tree-optimization/19038

The reason the two names in this testcase can't coalesce (which blocks
us from creating a single loop bb) is because we replace a loop
invariant name with a loop variant one.

Andrew Pinski says:

<pinskia> DannyB: all the loops in thin6d.f looks so much better now,

In general, replacing invariant things with variant ones is a bad idea,
and can only increase register pressure, besides the affect it had on

This patch stops DOM from performing this copy propagation.
An earlier patch had stopped DOM from doing this during expression
replacement, so hopefully this isn't controversial.

Bootstrapped and regtested on i686-pc-linux-gnu.
Okay for mainline?


2005-01-20  Daniel Berlin  <>

	Fix PR tree-optimization/19038
	* tree-ssa-dom.c (cprop_operand): Don't replace loop invariant copies
	with loop variant ones.
Index: tree-ssa-dom.c
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-dom.c,v
retrieving revision 2.86
diff -u -p -r2.86 tree-ssa-dom.c
--- tree-ssa-dom.c	18 Jan 2005 04:38:59 -0000	2.86
+++ tree-ssa-dom.c	21 Jan 2005 19:29:34 -0000
@@ -2819,6 +2819,10 @@ cprop_operand (tree stmt, use_operand_p 
 	 extensions.  */
       else if (!may_propagate_copy (op, val))
 	return false;
+      /* Don't replace loop invariant variables with loop variant copies.  */   
+      if (loop_depth_of_name (val) > loop_depth_of_name (op))
+	return false;
       /* Dump details.  */
       if (dump_file && (dump_flags & TDF_DETAILS))

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