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]

[lno, ?tree-ssa] Fix coalesce_tpa_members


Hello,

I have encountered the following problem during lno-branch testing, very
probably it also applies to tree-ssa branch (although I do not have a
testcase for it):

Suppose you have a function with parameter s and the following partitions

s
s_1
s_2

in coalesce_tpa_members, suppose p_1 is the partition s_1.  In the first
iteration, it is coalesced with partition s, and s is made the root
variable of the partition; var however still is s_1.  In the second
iteration it is coalesced with s_2, and since s_1 is an ordinary ssa
name, the root variable of the created partition is s_2 (i.e. it is not
replaced by s).

As a result, s is replaced with a temporary variable everywhere, thus
making the parameter unused and causing misscompilation.  This patch
fixes it by setting the var to point always to the root of the first
partition.

Zdenek

Index: ChangeLog.lno
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/ChangeLog.lno,v
retrieving revision 1.1.2.70
diff -c -3 -p -r1.1.2.70 ChangeLog.lno
*** ChangeLog.lno	3 Mar 2004 21:33:09 -0000	1.1.2.70
--- ChangeLog.lno	4 Mar 2004 11:56:22 -0000
***************
*** 1,3 ****
--- 1,8 ----
+ 2004-03-04  Zdenek Dvorak  <rakdver@atrey.karlin.mff.cuni.cz>
+ 
+ 	* tree-ssa-loop-live.c (coalesce_tpa_members): Update the root
+ 	variable of the partition.
+ 
  2004-03-03  Zdenek Dvorak  <rakdver@atrey.karlin.mff.cuni.cz>
  
  	* tree-ssa-loop-ivopts.c (enum iv_position): Add IP_ORIGINAL.
Index: tree-ssa-live.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-live.c,v
retrieving revision 1.1.2.33.2.2
diff -c -3 -p -r1.1.2.33.2.2 tree-ssa-live.c
*** tree-ssa-live.c	21 Feb 2004 23:10:04 -0000	1.1.2.33.2.2
--- tree-ssa-live.c	4 Mar 2004 11:56:23 -0000
*************** coalesce_tpa_members (tpa_p tpa, conflic
*** 1632,1637 ****
--- 1632,1642 ----
  			conflict_graph_merge_regs (graph, v, y);
  			p1 = v;
  		      }
+ 
+ 		    /* The root variable of the partition may be changed
+ 		       now.  */
+ 		    var = partition_to_var (map, p1);
+ 
  		    if (debug)
  		      fprintf (debug, ": Success -> %d\n", v);
  		  }


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