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]
Other format: [Raw text]

[ tree-ssa] PRE problem


So given this dump before PRE:

void _Jv_VerifyMethod() ()
{
  char * T.2;
  char T.1;
  char * T.0;
  struct type <D1709>;
  struct _Jv_BytecodeVerifier * const this;
  char * & p;
  char * p;
  struct type arg_types[20];
  struct _Jv_Utf8Const * method_signature;
  struct
  {
  } * T.7;
  struct type <D1695>;
  struct
  {
  } * arg_types.6;
  char T.5;
  char * p.4;
  char * method_signature.3;
  struct _Jv_BytecodeVerifier * const this;
  struct _Jv_BytecodeVerifier * const this;
  struct _Jv_BytecodeVerifier v;
  struct type retval.8;

  # BLOCK 0
  # PRED: ENTRY [100.0%]  (fallthru,exec)
  # SUCC: 1 [100.0%]  (fallthru,exec)

  # BLOCK 1
  # PRED: 5 [33.3%]  (dfs_back,false,exec) 0 [100.0%]  (fallthru,exec)
  # <D1695>_20 = PHI <<D1695>_22(0), <D1695>_21(5)>;
<L0>:;
  method_signature.3_4 = (char *)method_signature_3;
  goto <bb 5> (<L5>);
  # SUCC: 5 [100.0%]  (fallthru,exec)

  # BLOCK 2
  # PRED: 3 [90.0%]  (true,exec)
<L2>:;
  T.2_17 = p_18 + 1B;
  # SUCC: 3 [100.0%]  (fallthru,dfs_back,exec)

  # BLOCK 3
  # PRED: 5 [33.3%]  (true,exec) 2 [100.0%]  (fallthru,dfs_back,exec)
  # p_18 = PHI <p_19(5), T.2_17(2)>;
<L3>:;
  #   VUSE <<D1695>_21>;
  T.1_11 = *p_18;
  if (T.1_11 == 91) goto <L2>; else goto <L4>;
  # SUCC: 4 [10.0%]  (false,exec) 2 [90.0%]  (true,exec)

  # BLOCK 4
  # PRED: 3 [10.0%]  (false,exec)
<L4>:;
  #   retval.8_14 = VDEF <retval.8_13>;
  #   VUSE <<D1709>_12>;
  retval.8 = <D1709>;
  #   <D1695>_24 = VDEF <<D1695>_21>;
  #   VUSE <retval.8_14>;
  <D1695> = retval.8;
  # SUCC: 5 [100.0%]  (fallthru,dfs_back,exec)

  # BLOCK 5
  # PRED: 4 [100.0%]  (fallthru,dfs_back,exec) 1 [100.0%]  (fallthru,exec)
  # <D1695>_21 = PHI <<D1695>_20(1), <D1695>_24(4)>;
  # p_19 = PHI <method_signature.3_4(1), p_18(4)>;
<L5>:;
  #   VUSE <<D1695>_21>;
  T.5_6 = *p_19;
  if (T.5_6 != 41) goto <L3>; else goto <L0>;
  # SUCC: 1 [33.3%]  (dfs_back,false,exec) 3 [33.3%]  (true,exec)

}

Note the PHI nodes for block #5 and the first statement in block #5.

We will ultimately call generate_expr_as_of_bb for the following expression:

T.5_6 = *p_19

For block #1.


That generates the following expression:

T.5_6 = *method_signature.3_4

Seems reasonable.

The problem is we do this substitution (reverse copy propagation) *without*
fixing up the annotation for method_signature.3.  Specifically, if we do this
kind of substitution we need to fix is_dereferenced_{load,store} and
type_mem_tag in method_signature.3's annotation.

This code really should be using propagate_copy instead of blindly 
performing copy propagations.  propagate_copy will actually take care
of properly updating the annotations and such.

Unfortunately, that's not immediately possible because the code in 
question actually tries to perform copy propagations which are not
safe (for example, copy propagation when the two objects have different
memory tags).

I don't know the code well enough to know how best to fix this problem.  But
it is something which is holding up significant work.

You can trigger this class of problems by inserting the following code
into tree-ssa-pre.c, then trying to build libstdc++:



Index: tree-ssa-pre.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-pre.c,v
retrieving revision 1.1.4.129
diff -c -p -r1.1.4.129 tree-ssa-pre.c
*** tree-ssa-pre.c	30 Jan 2004 13:14:18 -0000	1.1.4.129
--- tree-ssa-pre.c	20 Feb 2004 17:42:30 -0000
*************** generate_expr_as_of_bb (tree expr, basic
*** 1223,1228 ****
--- 1223,1230 ----
  	    {
  	      int opnum = opnum_of_phi (phi, pred->index);
  	      tree p = PHI_ARG_DEF (phi, opnum);
+ 	      if (! may_propagate_copy (*vp, p))
+ 		abort ();
  	      *vp = p;
  	      if (!phi_ssa_name_p (p))
  		replaced_constants = true;
*************** generate_vops_as_of_bb (tree expr, basic
*** 1258,1263 ****
--- 1260,1267 ----
  	    {
  	      int opnum = opnum_of_phi (phi, pred->index);
  	      tree p = PHI_ARG_DEF (phi, opnum);
+ 	      if (! may_propagate_copy (VUSE_OP (vuses, i), p))
+ 		abort ();
  	      *VUSE_OP_PTR (vuses, i) = p;
  	      break;
  	    }









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