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]

[tree-ssa] gimplifier problem in libjava


Jeff, Andrew,

I have a patch for the problem that Andrew mentioned in
http://gcc.gnu.org/ml/gcc/2003-09/msg01125.html that seems to work, but
is giving me a weird ICE in gimplify_expr on libjava on x86-64.

The patch just changes the call-clobbering logic in the SSA optimizer to
ignore TREE_READONLY variables at call sites.  So that, for the code
that Andrew posted, we produce the following:

;; Function foo (foo)                   ;; Function foo (foo)

foo ()                                  foo ()
{                                       {
  int T.1;                            <
  int n;                                  int n;

  n = a[0];                               n = a[0];
  f ();                                   f ();
  T.1 = a[0];                         |   n = n + n;
  n = n + T.1;                        <
  return n;;                              return n;;
}                                       }


I have no idea why this change would affect the gimplifier.  On x86-64,
we get the following when compiling java/lang/Runtime.java:

gimplification failed:
if (cmd.293 == 0B)
  {
    _Jv_ThrowNullPointerException ()
  } 
else
  {
    iftmp.292 = cmd.293
  }

This is while trying a checked array reference.  Going up a few frames:

iftmp.292->data[i.296 >= T.299 && T.300 != 0;
(struct java.lang.String[] *)(if (cmd.293 == 0B)
  {
    _Jv_ThrowNullPointerException ()
  }
else
  {
    iftmp.292 = cmd.293
  });
SAVE_EXPR <i.295>;] = SAVE_EXPR <SAVE_EXPR <t>;

The problem is that gimplify_expr is asked to gimplify the inner
COND_EXPR into a gimple value, which it can't do.

I don't really know how my change could have triggered this.  If you
have access to x86-64, could you try this patch?  If not, well, I guess
I'll keep beating my head against the gimplifier :)


Thanks.  Diego.


Index: tree-dfa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-dfa.c,v
retrieving revision 1.1.4.167
diff -d -c -p -r1.1.4.167 tree-dfa.c
*** tree-dfa.c  8 Oct 2003 23:35:08 -0000       1.1.4.167
--- tree-dfa.c  9 Oct 2003 16:42:20 -0000
*************** add_call_clobber_ops (tree stmt, voperan
*** 865,871 ****
        for (i = 0; i < num_call_clobbered_vars; i++)
        { 
          tree var = call_clobbered_var (i);
!         add_stmt_operand (&var, stmt, opf_force_vop|opf_is_def, prev_vops);
        }
      }
  }
--- 865,876 ----
        for (i = 0; i < num_call_clobbered_vars; i++)
        { 
          tree var = call_clobbered_var (i);
!
!         /* If VAR is read-only, don't add a VDEF, just a VUSE operand.  */
!         if (!TREE_READONLY (var))
!           add_stmt_operand (&var, stmt, opf_force_vop|opf_is_def, prev_vops);
!         else
!           add_stmt_operand (&var, stmt, opf_force_vop, prev_vops);
        }
      }
  }



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