[tree-ssa] Question: going in and out of SSA

Devang Patel dpatel@apple.com
Wed Dec 31 23:39:00 GMT 2003


It seems, after going through various optimization passes,
SSA tree IR does not maintain form that allows me to
rewrite trees in & out of SSA form.

For example,

--- foo.c ---
void foo(int *a, int len)
{
         int i;
         for (i = 0; i < len; i++)
           a[i] = 0;
         return;
}

I get following ICE (inside rewrite_into_ssa()) while compiling foo.c 
using -O2
foo.c:2: internal compiler error: in get_expr_operands, at 
tree-ssa-operands.c:905

This is the only change I've in my local tree:

Index: tree-optimize.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-optimize.c,v
retrieving revision 1.1.4.96
diff -Idpatel.pbxuser -c -6 -p -r1.1.4.96 tree-optimize.c
*** tree-optimize.c     17 Dec 2003 19:53:02 -0000      1.1.4.96
--- tree-optimize.c     31 Dec 2003 21:23:54 -0000
*************** optimize_function_tree (tree fndecl, tre
*** 247,259 ****

   #ifdef ENABLE_CHECKING
         verify_flow_info ();
         verify_stmts ();
         verify_ssa ();
   #endif
!
         /* Rewrite the function out of SSA form.  */
         rewrite_out_of_ssa (fndecl, TDI_optimized);
         ggc_collect ();

         /* Flush out flow graph and SSA data.  */
         BITMAP_XFREE (vars_to_rename);
--- 247,265 ----

   #ifdef ENABLE_CHECKING
         verify_flow_info ();
         verify_stmts ();
         verify_ssa ();
   #endif
!       {
!       int i;
!       rewrite_out_of_ssa (fndecl, TDI_optimized);
!       for (i = 0; i < num_referenced_vars; i++)
!         var_ann (referenced_var (i))->out_of_ssa_tag = 0;
!       rewrite_into_ssa (fndecl, NULL, TDI_ssa_2);
!       }
         /* Rewrite the function out of SSA form.  */
         rewrite_out_of_ssa (fndecl, TDI_optimized);
         ggc_collect ();

         /* Flush out flow graph and SSA data.  */
         BITMAP_XFREE (vars_to_rename);


Is it a bug OR expected behavior OR uncharted territory OR am I not
clearing everything ? For this transformation (loop versioning) I'm
ready to think harder and avoid this path (ie going in and out of SSA)
but what is generally preferred way for various loop transformations ?

Thank you,
--
Devang



More information about the Gcc mailing list