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]

[PATCH][alias-improvements] VOP safety net during early-optimizations


This makes the virtual operands safety-net available as soon as we go
into SSA.  Which means we can get rid of the hack of setting volatile-ops
on memory statements during early optimizations.  It also means that any
pass should just work during early optimizations.  The only difference
to full alias information is the lack of points-to information (which
is at the moment not used at all on the branch).

I have cleaned up (aka simplified) tree-ssa-operands.c somewhat, 
update_stmt now automatically renames the single virtual operand if
there is a relevant change.  For this I had to (partly) privatize
update-ssa information to be per-function - this probably should be
completed, but it's a maze and two half-heartedly attempts failed ;)

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to the
branch.  There are a few more optimization regressions now, mostly
related to CCP improperly handling virtual operands as restrictions.

Richard.

2008-11-20  Richard Guenther  <rguenther@suse.de>

	* tree-flow.h (struct gimple_df): Add vop_needs_renaming flag.
	* tree-into-ssa.c (symbol_marked_for_renaming): Adjust for
	vop_needs_renaming flag.
	(is_old_name): Likewise.
	(is_new_name): Likewise.
	(pass_build_ssa): Run TODO_update_ssa_only_virtuals.
	(dump_update_ssa): Dump vop_needs_renaming.
	(delete_update_ssa): Clear delete_update_ssa.
	(mark_sym_for_renaming): Adjust for vop_needs_renaming flag.
	(need_ssa_update_p): Likewise.
	(release_ssa_name_after_update_ssa): Likewise.
	(update_ssa): Likewise.
	* ipa-cp.c (ipcp_update_callgraph): Update SSA form.
	* tree-ssa-alias.c (create_vop_var): Remove.
	(compute_may_aliases): Do not call it here.
	(may_point_to_global_var): Handle pointer constants.
	* tree-inline.c (expand_call_inline): Mark the VOP for renaming.
	* gimple.h (gimple_loaded_syms): Note that we should fix this
	interface.
	* tree-ssa-operands.c (create_vop_var): Move here.
	(init_ssa_operands): Call it.
	(fini_ssa_operands): Clear gimple_df->vop.
	(finalize_ssa_vdefs): Mark the VOP for renaming on changes.
	(finalize_ssa_vuse_ops): Likewise.
	(append_vdef): Simplify.
	(append_vuse): Likewise.
	(access_can_touch_variable): Remove.
	(add_virtual_operand): Simplify.
	(get_addr_dereference_operands): Remove.
	(get_indirect_ref_operands): Simplify.
	(get_tmr_operands): Likewise.
	(add_call_clobber_ops): Remove.
	(add_call_read_ops): Likewise.
	(maybe_add_call_clobbered_vops): Rename to ...
	(maybe_add_call_vops): ... this.  Inline remanents of the
	removed functions.
	(get_expr_operands): Simplify.
	(create_ssa_artificial_load_stmt): Likewise.
	* tree-call-cdce.c (tree_call_cdce): Rename the VOP.
	* tree-cfg.c (mark_virtual_ops_in_region): Remove.
	(move_sese_region_to_fn): Do not call it.
	* omp-low.c (expand_omp_taskreg): Update SSA form.
	* tree-ssa.c (execute_update_addresses_taken): Update for
	single VOP.

Index: gcc/tree-into-ssa.c
===================================================================
*** gcc/tree-into-ssa.c.orig	2008-11-23 20:35:41.000000000 +0100
--- gcc/tree-into-ssa.c	2008-11-23 22:15:45.000000000 +0100
*************** set_livein_block (tree var, basic_block 
*** 585,590 ****
--- 585,597 ----
  static inline bool
  symbol_marked_for_renaming (tree sym)
  {
+   if (sym == gimple_vop (cfun)
+       && cfun->gimple_df->vop_needs_renaming)
+     return true;
+ 
+   if (!syms_to_rename)
+     return false;
+ 
    return bitmap_bit_p (syms_to_rename, DECL_UID (sym));
  }
  
*************** static inline bool
*** 595,600 ****
--- 602,609 ----
  is_old_name (tree name)
  {
    unsigned ver = SSA_NAME_VERSION (name);
+   if (!new_ssa_names)
+     return false;
    return ver < new_ssa_names->n_bits && TEST_BIT (old_ssa_names, ver);
  }
  
*************** static inline bool
*** 605,610 ****
--- 614,621 ----
  is_new_name (tree name)
  {
    unsigned ver = SSA_NAME_VERSION (name);
+   if (!new_ssa_names)
+     return false;
    return ver < new_ssa_names->n_bits && TEST_BIT (new_ssa_names, ver);
  }
  
*************** struct gimple_opt_pass pass_build_ssa = 
*** 2293,2298 ****
--- 2304,2310 ----
    0,					/* properties_destroyed */
    0,					/* todo_flags_start */
    TODO_dump_func
+     | TODO_update_ssa_only_virtuals
      | TODO_verify_ssa
      | TODO_remove_unused_locals		/* todo_flags_finish */
   }
*************** dump_update_ssa (FILE *file)
*** 2609,2614 ****
--- 2621,2631 ----
        fprintf (file, "\n\nSymbols to be put in SSA form\n\n");
        dump_decl_set (file, syms_to_rename);
      }
+   if (cfun->gimple_df->vop_needs_renaming)
+     {
+       print_generic_expr (file, gimple_vop (cfun), 0);
+       fprintf (file, "\n");
+     }
  
    if (names_to_release && !bitmap_empty_p (names_to_release))
      {
*************** delete_update_ssa (void)
*** 2667,2672 ****
--- 2684,2691 ----
    unsigned i;
    bitmap_iterator bi;
  
+   cfun->gimple_df->vop_needs_renaming = false;
+ 
    sbitmap_free (old_ssa_names);
    old_ssa_names = NULL;
  
*************** register_new_name_mapping (tree new_Tree
*** 2765,2770 ****
--- 2784,2795 ----
  void
  mark_sym_for_renaming (tree sym)
  {
+   if (sym == gimple_vop (cfun))
+     {
+       cfun->gimple_df->vop_needs_renaming = true;
+       return;
+     }
+ 
    if (need_to_initialize_update_ssa_p)
      init_update_ssa ();
  
*************** mark_set_for_renaming (bitmap set)
*** 2803,2809 ****
  bool
  need_ssa_update_p (void)
  {
!   return syms_to_rename || old_ssa_names || new_ssa_names;
  }
  
  /* Return true if SSA name mappings have been registered for SSA updating.  */
--- 2828,2837 ----
  bool
  need_ssa_update_p (void)
  {
!   return ((cfun
! 	   && cfun->gimple_df
! 	   && cfun->gimple_df->vop_needs_renaming)
! 	  || syms_to_rename || old_ssa_names || new_ssa_names);
  }
  
  /* Return true if SSA name mappings have been registered for SSA updating.  */
*************** ssa_names_to_replace (void)
*** 2850,2856 ****
  void
  release_ssa_name_after_update_ssa (tree name)
  {
!   gcc_assert (!need_to_initialize_update_ssa_p);
  
    if (names_to_release == NULL)
      names_to_release = BITMAP_ALLOC (NULL);
--- 2878,2885 ----
  void
  release_ssa_name_after_update_ssa (tree name)
  {
!   gcc_assert (!need_to_initialize_update_ssa_p
! 	      || cfun->gimple_df->vop_needs_renaming);
  
    if (names_to_release == NULL)
      names_to_release = BITMAP_ALLOC (NULL);
*************** update_ssa (unsigned update_flags)
*** 3115,3120 ****
--- 3144,3155 ----
  
    timevar_push (TV_TREE_SSA_INCREMENTAL);
  
+   if (need_to_initialize_update_ssa_p)
+     {
+       gcc_assert (cfun->gimple_df->vop_needs_renaming);
+       init_update_ssa ();
+     }
+ 
    blocks_with_phis_to_rewrite = BITMAP_ALLOC (NULL);
    if (!phis_to_rewrite)
      phis_to_rewrite = VEC_alloc (gimple_vec, heap, last_basic_block);
*************** update_ssa (unsigned update_flags)
*** 3166,3171 ****
--- 3201,3212 ----
    /* If there are symbols to rename, identify those symbols that are
       GIMPLE registers into the set REGS_TO_RENAME and those that are
       memory symbols into the set MEM_SYMS_TO_RENAME.  */
+   if (cfun->gimple_df->vop_needs_renaming)
+     {
+       bitmap_set_bit (syms_to_rename, DECL_UID (gimple_vop (cfun)));
+       cfun->gimple_df->vop_needs_renaming = false;
+       need_to_update_vops_p = true;
+     }
    if (!bitmap_empty_p (syms_to_rename))
      {
        unsigned i;
Index: gcc/ipa-cp.c
===================================================================
*** gcc/ipa-cp.c.orig	2008-11-23 20:40:40.000000000 +0100
--- gcc/ipa-cp.c	2008-11-23 21:44:30.000000000 +0100
*************** ipcp_update_callgraph (void)
*** 972,977 ****
--- 972,981 ----
  		gsi = gsi_for_stmt (cs->call_stmt);
  		gsi_replace (&gsi, new_stmt, true);
  		cgraph_set_call_stmt (cs, new_stmt);
+ 		/* ???  We loose pure/const or clobber information during
+ 		   cloning so we may end up with different VOPs for
+ 		   the call.  See gcc.c-torture/execute/20000113-1.c.  */
+ 		update_ssa (TODO_update_ssa);
  	        pop_cfun ();
  		current_function_decl = NULL;
  	      }
Index: gcc/tree-inline.c
===================================================================
*** gcc/tree-inline.c.orig	2008-11-23 20:40:42.000000000 +0100
--- gcc/tree-inline.c	2008-11-23 21:44:30.000000000 +0100
*************** expand_call_inline (basic_block bb, gimp
*** 3395,3400 ****
--- 3395,3403 ----
  
    id->block = NULL_TREE;
    successfully_inlined = TRUE;
+   /* ???  This should not be necessary if we update stmts correctly.  */
+   if (gimple_in_ssa_p (cfun))
+     mark_sym_for_renaming (gimple_vop (cfun));
  
   egress:
    input_location = saved_location;
Index: gcc/tree-flow.h
===================================================================
*** gcc/tree-flow.h.orig	2008-11-23 20:40:42.000000000 +0100
--- gcc/tree-flow.h	2008-11-23 22:09:31.000000000 +0100
*************** struct gimple_df GTY(())
*** 193,198 ****
--- 193,201 ----
    /* True if the code is in ssa form.  */
    unsigned int in_ssa_p : 1;
  
+   /* True if the VOP needs to be renamed.  */
+   unsigned int vop_needs_renaming : 1;
+ 
    struct ssa_operands ssa_operands;
  
    /* Memory reference statistics collected during alias analysis.
Index: gcc/gimple.h
===================================================================
*** gcc/gimple.h.orig	2008-11-23 20:40:42.000000000 +0100
--- gcc/gimple.h	2008-11-23 21:44:30.000000000 +0100
*************** gimple_loaded_syms (const_gimple g)
*** 1399,1405 ****
  
  
  /* Return the set of symbols stored by statement G.  Each element of
!    the set is the DECL_UID of the corresponding symbol.  */
  
  static inline bitmap
  gimple_stored_syms (const_gimple g)
--- 1399,1407 ----
  
  
  /* Return the set of symbols stored by statement G.  Each element of
!    the set is the DECL_UID of the corresponding symbol.
!    ???  This is at most one symbol which is directly stored.
!    	A cheaper representation would be possible.  */
  
  static inline bitmap
  gimple_stored_syms (const_gimple g)
Index: gcc/tree-ssa-operands.c
===================================================================
*** gcc/tree-ssa-operands.c.orig	2008-11-23 20:35:41.000000000 +0100
--- gcc/tree-ssa-operands.c	2008-11-23 22:09:16.000000000 +0100
*************** add_vop_to_freelist (voptype_p ptr)
*** 355,360 ****
--- 355,385 ----
    gimple_ssa_operands (cfun)->vop_free_buckets[bucket] = ptr;
  }
   
+ /* Create the VOP variable, an artificial global variable to act as a
+    representative of all of the virtual operands FUD chain.  */
+ 
+ static void
+ create_vop_var (void)
+ {
+   tree global_var;
+ 
+   gcc_assert (cfun->gimple_df->vop == NULL_TREE);
+ 
+   global_var = build_decl (VAR_DECL, get_identifier (".MEM"),
+ 			   void_type_node);
+   DECL_ARTIFICIAL (global_var) = 1;
+   TREE_READONLY (global_var) = 0;
+   DECL_EXTERNAL (global_var) = 1;
+   TREE_STATIC (global_var) = 1;
+   TREE_USED (global_var) = 1;
+   DECL_CONTEXT (global_var) = NULL_TREE;
+   TREE_THIS_VOLATILE (global_var) = 0;
+   TREE_ADDRESSABLE (global_var) = 0;
+ 
+   create_var_ann (global_var);
+   add_referenced_var (global_var);
+   cfun->gimple_df->vop = global_var;
+ }
  
  /* These are the sizes of the operand memory  buffer which gets allocated each 
     time more operands space is required.  The final value is the amount that is
*************** init_ssa_operands (void)
*** 390,395 ****
--- 415,421 ----
    memset (&clobber_stats, 0, sizeof (clobber_stats));
    init_vop_buckets ();
    gimple_ssa_operands (cfun)->ssa_operand_mem_size = OP_SIZE_INIT;
+   create_vop_var ();
  }
  
  
*************** fini_ssa_operands (void)
*** 442,447 ****
--- 468,475 ----
    if (!n_initialized)
      bitmap_obstack_release (&operands_bitmap_obstack);
  
+   cfun->gimple_df->vop = NULL_TREE;
+ 
    if (dump_file && (dump_flags & TDF_STATS))
      {
        fprintf (dump_file, "Original clobbered vars:           %d\n",
*************** finalize_ssa_vdefs (gimple stmt)
*** 788,803 ****
    /* Set the symbols referenced by STMT.  */
    gimple_set_stored_syms (stmt, build_stores, &operands_bitmap_obstack);
  
-   /* If aliases have not been computed, do not instantiate a virtual
-      operator on STMT.  Initially, we only compute the SSA form on
-      GIMPLE registers.  The virtual SSA form is only computed after
-      alias analysis, so virtual operators will remain unrenamed and
-      the verifier will complain.  However, alias analysis needs to
-      access symbol load/store information, so we need to compute
-      those.  */
-   if (!gimple_aliases_computed_p (cfun))
-     return;
- 
    new_list.next = NULL;
    last = &new_list;
  
--- 816,821 ----
*************** finalize_ssa_vdefs (gimple stmt)
*** 836,848 ****
  	{
  	  /* This is a new operand.  */
  	  last = add_vdef_op (stmt, op, 1, last);
  	  new_i++;
  	}
      }
  
    /* If there is anything remaining in BUILD_VDEFS, simply emit it.  */
    for ( ; new_i < VEC_length (tree, build_vdefs); new_i++)
!     last = add_vdef_op (stmt, VEC_index (tree, build_vdefs, new_i), 1, last);
  
    /* If there is anything in the old list, free it.  */
    if (old_ops)
--- 854,870 ----
  	{
  	  /* This is a new operand.  */
  	  last = add_vdef_op (stmt, op, 1, last);
+ 	  mark_sym_for_renaming (gimple_vop (cfun));
  	  new_i++;
  	}
      }
  
    /* If there is anything remaining in BUILD_VDEFS, simply emit it.  */
    for ( ; new_i < VEC_length (tree, build_vdefs); new_i++)
!     {
!       last = add_vdef_op (stmt, VEC_index (tree, build_vdefs, new_i), 1, last);
!       mark_sym_for_renaming (gimple_vop (cfun));
!     }
  
    /* If there is anything in the old list, free it.  */
    if (old_ops)
*************** finalize_ssa_vdefs (gimple stmt)
*** 853,858 ****
--- 875,881 ----
  	  delink_imm_use (VDEF_OP_PTR (ptr, 0));
  	  add_vop_to_freelist (ptr);
  	}
+       mark_sym_for_renaming (gimple_vop (cfun));
      }
  
    /* Now set STMT's operands.  */
*************** finalize_ssa_vuse_ops (gimple stmt)
*** 883,898 ****
    /* Set the symbols referenced by STMT.  */
    gimple_set_loaded_syms (stmt, build_loads, &operands_bitmap_obstack);
  
-   /* If aliases have not been computed, do not instantiate a virtual
-      operator on STMT.  Initially, we only compute the SSA form on
-      GIMPLE registers.  The virtual SSA form is only computed after
-      alias analysis, so virtual operators will remain unrenamed and
-      the verifier will complain.  However, alias analysis needs to
-      access symbol load/store information, so we need to compute
-      those.  */
-   if (!gimple_aliases_computed_p (cfun))
-     return;
- 
    /* STMT should have at most one VUSE operator.  */
    old_ops = gimple_vuse_ops (stmt);
    gcc_assert (old_ops == NULL || old_ops->next == NULL);
--- 906,911 ----
*************** finalize_ssa_vuse_ops (gimple stmt)
*** 955,960 ****
--- 968,974 ----
  
        gimple_set_vuse_ops (stmt, last);
        VEC_free (tree, heap, new_ops);
+       mark_sym_for_renaming (gimple_vop (cfun));
      }
  
  #ifdef ENABLE_CHECKING
*************** append_use (tree *use_p)
*** 1095,1162 ****
  /* Add VAR to the set of variables that require a VDEF operator.  */
  
  static inline void
! append_vdef (tree var)
  {
    tree vop = gimple_vop (cfun);
    var_ann_t ann;
  
-   if (TREE_CODE (var) == VAR_DECL
-       || TREE_CODE (var) == PARM_DECL
-       || TREE_CODE (var) == RESULT_DECL)
-     bitmap_set_bit (build_stores, DECL_UID (var));
- 
-   if (!vop)
-     return;
    ann = var_ann (vop);
    if (ann->in_vdef_list)
      return;
    ann->in_vdef_list = true;
    VEC_safe_push (tree, heap, build_vdefs, vop);
-   /* ???  Necessary?  */
-   bitmap_set_bit (build_stores, DECL_UID (vop));
- #if 0
-   if (TREE_CODE (var) != SSA_NAME)
-     {
-       tree mpt;
-       var_ann_t ann;
- 
-       /* If VAR belongs to a memory partition, use it instead of VAR.  */
-       mpt = memory_partition (var);
-       if (mpt)
- 	var = mpt;
- 
-       /* Don't allow duplicate entries.  */
-       ann = get_var_ann (var);
-       if (ann->in_vdef_list)
-         return;
- 
-       ann->in_vdef_list = true;
-       sym = var;
-     }
-   else
-     sym = SSA_NAME_VAR (var);
- 
-   VEC_safe_push (tree, heap, build_vdefs, var);
-   bitmap_set_bit (build_stores, DECL_UID (sym));
- #endif
  }
  
  
  /* Add VAR to the set of variables that require a VUSE operator.  */
  
  static inline void
! append_vuse (tree var)
  {
    tree vop = gimple_vop (cfun);
    var_ann_t ann;
  
-   if (TREE_CODE (var) == VAR_DECL
-       || TREE_CODE (var) == PARM_DECL
-       || TREE_CODE (var) == RESULT_DECL)
-     bitmap_set_bit (build_loads, DECL_UID (var));
- 
-   if (!vop)
-     return;
    ann = var_ann (vop);
    if (ann->in_vuse_list)
      return;
--- 1109,1135 ----
  /* Add VAR to the set of variables that require a VDEF operator.  */
  
  static inline void
! append_vdef (void)
  {
    tree vop = gimple_vop (cfun);
    var_ann_t ann;
  
    ann = var_ann (vop);
    if (ann->in_vdef_list)
      return;
    ann->in_vdef_list = true;
    VEC_safe_push (tree, heap, build_vdefs, vop);
  }
  
  
  /* Add VAR to the set of variables that require a VUSE operator.  */
  
  static inline void
! append_vuse (void)
  {
    tree vop = gimple_vop (cfun);
    var_ann_t ann;
  
    ann = var_ann (vop);
    if (ann->in_vuse_list)
      return;
*************** append_vuse (tree var)
*** 1165,1347 ****
        ann->in_vuse_list = true;
        VEC_safe_push (tree, heap, build_vuses, vop);
      }
-   /* ???  Necessary?  */
-   bitmap_set_bit (build_loads, DECL_UID (vop));
- #if 0
-   tree sym;
- 
-   if (TREE_CODE (var) != SSA_NAME)
-     {
-       tree mpt;
-       var_ann_t ann;
- 
-       /* If VAR belongs to a memory partition, use it instead of VAR.  */
-       mpt = memory_partition (var);
-       if (mpt)
- 	var = mpt;
- 
-       /* Don't allow duplicate entries.  */
-       ann = get_var_ann (var);
-       if (ann->in_vuse_list)
- 	return;
-       else if (ann->in_vdef_list)
-        {
-          /* We don't want a vuse if we already have a vdef, but we must
-             still put this in build_loads.  */
-          bitmap_set_bit (build_loads, DECL_UID (var));
-          return;
-        }
- 
-       ann->in_vuse_list = true;
-       sym = var;
-     }
-   else
-     sym = SSA_NAME_VAR (var);
- 
-   VEC_safe_push (tree, heap, build_vuses, var);
-   bitmap_set_bit (build_loads, DECL_UID (sym));
- #endif
- }
- 
- 
- /* REF is a tree that contains the entire pointer dereference
-    expression, if available, or NULL otherwise.  ALIAS is the variable
-    we are asking if REF can access.  OFFSET and SIZE come from the
-    memory access expression that generated this virtual operand.
- 
-    XXX: We should handle the NO_ALIAS attributes here.  */
- 
- static bool
- access_can_touch_variable (tree ref, tree alias, HOST_WIDE_INT offset,
- 			   HOST_WIDE_INT size)
- {
-   bool offsetgtz = offset > 0;
-   unsigned HOST_WIDE_INT uoffset = (unsigned HOST_WIDE_INT) offset;
-   tree base = ref ? get_base_address (ref) : NULL;
- 
-   /* If ALIAS is .GLOBAL_VAR then the memory reference REF must be
-      using a call-clobbered memory tag.  By definition, call-clobbered
-      memory tags can always touch .GLOBAL_VAR.  */
-   if (alias == gimple_global_var (cfun))
-     return true;
- 
-   /* If ref is a TARGET_MEM_REF, just return true, as we can't really
-      disambiguate them right now.  */
-   if (ref && TREE_CODE (ref) == TARGET_MEM_REF)
-     return true;
-   
-   /* Without strict aliasing, it is impossible for a component access
-      through a pointer to touch a random variable, unless that
-      variable *is* a structure or a pointer.
- 
-      That is, given p->c, and some random global variable b,
-      there is no legal way that p->c could be an access to b.
-      
-      Without strict aliasing on, we consider it legal to do something
-      like:
- 
-      struct foos { int l; };
-      int foo;
-      static struct foos *getfoo(void);
-      int main (void)
-      {
-        struct foos *f = getfoo();
-        f->l = 1;
-        foo = 2;
-        if (f->l == 1)
-          abort();
-        exit(0);
-      }
-      static struct foos *getfoo(void)     
-      { return (struct foos *)&foo; }
-      
-      (taken from 20000623-1.c)
- 
-      The docs also say/imply that access through union pointers
-      is legal (but *not* if you take the address of the union member,
-      i.e. the inverse), such that you can do
- 
-      typedef union {
-        int d;
-      } U;
- 
-      int rv;
-      void breakme()
-      {
-        U *rv0;
-        U *pretmp = (U*)&rv;
-        rv0 = pretmp;
-        rv0->d = 42;    
-      }
-      To implement this, we just punt on accesses through union
-      pointers entirely.
- 
-      Another case we have to allow is accessing a variable
-      through an array access at offset zero.  This happens from
-      code generated by the fortran frontend like
- 
-      char[1:1] & my_char_ref;
-      char my_char;
-      my_char_ref_1 = (char[1:1] &) &my_char;
-      D.874_2 = (*my_char_ref_1)[1]{lb: 1 sz: 1};
-   */
-   if (ref 
-       && flag_strict_aliasing
-       && TREE_CODE (ref) != INDIRECT_REF
-       && !MTAG_P (alias)
-       && base
-       && (TREE_CODE (base) != INDIRECT_REF
- 	  || TREE_CODE (TREE_TYPE (base)) != UNION_TYPE)
-       && (TREE_CODE (base) != INDIRECT_REF
- 	  || TREE_CODE (ref) != ARRAY_REF
- 	  || offset != 0
- 	  || (DECL_SIZE (alias)
- 	      && TREE_CODE (DECL_SIZE (alias)) == INTEGER_CST
- 	      && size != -1
- 	      && (unsigned HOST_WIDE_INT)size
- 	      != TREE_INT_CST_LOW (DECL_SIZE (alias))))
-       && !AGGREGATE_TYPE_P (TREE_TYPE (alias))
-       && TREE_CODE (TREE_TYPE (alias)) != COMPLEX_TYPE
-       && !var_ann (alias)->is_heapvar
-       /* When the struct has may_alias attached to it, we need not to
- 	 return true.  */
-       && get_alias_set (base))
-     {
- #ifdef ACCESS_DEBUGGING
-       fprintf (stderr, "Access to ");
-       print_generic_expr (stderr, ref, 0);
-       fprintf (stderr, " may not touch ");
-       print_generic_expr (stderr, alias, 0);
-       fprintf (stderr, " in function %s\n", get_name (current_function_decl));
- #endif
-       return false;
-     }
- 
-   /* If the offset of the access is greater than the size of one of
-      the possible aliases, it can't be touching that alias, because it
-      would be past the end of the structure.  */
-   else if (ref
- 	   && flag_strict_aliasing
- 	   && TREE_CODE (ref) != INDIRECT_REF
- 	   && !MTAG_P (alias)
- 	   && !var_ann (alias)->is_heapvar
- 	   && !POINTER_TYPE_P (TREE_TYPE (alias))
- 	   && offsetgtz
- 	   && DECL_SIZE (alias)
- 	   && TREE_CODE (DECL_SIZE (alias)) == INTEGER_CST
- 	   && uoffset >= TREE_INT_CST_LOW (DECL_SIZE (alias)))
-     {
- #ifdef ACCESS_DEBUGGING
-       fprintf (stderr, "Access to ");
-       print_generic_expr (stderr, ref, 0);
-       fprintf (stderr, " may not touch ");
-       print_generic_expr (stderr, alias, 0);
-       fprintf (stderr, " in function %s\n", get_name (current_function_decl));
- #endif
-       return false;
-     }	   
- 
-   return true;
  }
  
  /* Add VAR to the virtual operands for STMT.  FLAGS is as in
--- 1138,1143 ----
*************** access_can_touch_variable (tree ref, tre
*** 1352,1386 ****
     affected statement is a call site.  */
  
  static void
! add_virtual_operand (tree var, gimple stmt, int flags,
! 		     tree full_ref, HOST_WIDE_INT offset,
! 		     HOST_WIDE_INT size, bool is_call_site)
  {
-   bitmap aliases = NULL;
-   tree sym;
-   var_ann_t v_ann;
-   
-   sym = (TREE_CODE (var) == SSA_NAME ? SSA_NAME_VAR (var) : var);
-   v_ann = var_ann (sym);
-   
    /* Mark the statement as having memory operands.  */
    gimple_set_references_memory (stmt, true);
- 
-   /* If the variable cannot be modified and this is a VDEF change
-      it into a VUSE.  This happens when read-only variables are marked
-      call-clobbered and/or aliased to writable variables.  So we only
-      check that this only happens on non-specific stores.
- 
-      Note that if this is a specific store, i.e. associated with a
-      MODIFY_EXPR, then we can't suppress the VDEF, lest we run
-      into validation problems.
- 
-      This can happen when programs cast away const, leaving us with a
-      store to read-only memory.  If the statement is actually executed
-      at runtime, then the program is ill formed.  If the statement is
-      not executed then all is well.  At the very least, we cannot ICE.  */
-   if ((flags & opf_implicit) && unmodifiable_var_p (var))
-     flags &= ~opf_def;
    
    /* The variable is not a GIMPLE register.  Add it (or its aliases) to
       virtual operands, unless the caller has specifically requested
--- 1148,1157 ----
     affected statement is a call site.  */
  
  static void
! add_virtual_operand (gimple stmt, int flags)
  {
    /* Mark the statement as having memory operands.  */
    gimple_set_references_memory (stmt, true);
    
    /* The variable is not a GIMPLE register.  Add it (or its aliases) to
       virtual operands, unless the caller has specifically requested
*************** add_virtual_operand (tree var, gimple st
*** 1388,1471 ****
       ADDR_EXPR expression).  */
    if (flags & opf_no_vops)
      return;
-   
-   if (MTAG_P (var))
-     aliases = MTAG_ALIASES (var);
  
!   if (aliases == NULL)
!     {
!       if (!gimple_aliases_computed_p (cfun) && (flags & opf_def))
! 	gimple_set_has_volatile_ops (stmt, true);
! 
!       /* The variable is not aliased or it is an alias tag.  */
!       if (flags & opf_def)
! 	append_vdef (var);
!       else
! 	append_vuse (var);
!     }
    else
!     {
!       bitmap_iterator bi;
!       unsigned int i;
!       bool none_added = true;
!       
!       /* The variable is aliased.  Add its aliases to the virtual
! 	 operands.  */
!       gcc_assert (!bitmap_empty_p (aliases));
! 
!       EXECUTE_IF_SET_IN_BITMAP (aliases, 0, i, bi)
! 	{
! 	  tree al = referenced_var (i);
! 
! 	  /* Call-clobbered tags may have non-call-clobbered
! 	     symbols in their alias sets.  Ignore them if we are
! 	     adding VOPs for a call site.  */
! 	  if (is_call_site && !is_call_clobbered (al))
! 	    continue;
! 
! 	  /* If we do not know the full reference tree or if the access is
! 	     unspecified [0, -1], we cannot prune it.  Otherwise try doing
! 	     so using access_can_touch_variable.  */
! 	  if (full_ref
! 	      && !access_can_touch_variable (full_ref, al, offset, size))
! 	    continue;
! 
! 	  if (flags & opf_def)
! 	    append_vdef (al);
! 	  else
! 	    append_vuse (al);
! 	  none_added = false;
! 	}
! 
!       if (flags & opf_def)
! 	{
! 	  /* If the variable is also an alias tag, add a virtual
! 	     operand for it, otherwise we will miss representing
! 	     references to the members of the variable's alias set.	     
! 	     This fixes the bug in gcc.c-torture/execute/20020503-1.c.
! 	     
! 	     It is also necessary to add bare defs on clobbers for
! 	     SMT's, so that bare SMT uses caused by pruning all the
! 	     aliases will link up properly with calls.   In order to
! 	     keep the number of these bare defs we add down to the
! 	     minimum necessary, we keep track of which SMT's were used
! 	     alone in statement vdefs or VUSEs.  */
! 	  if (none_added
! 	      || (TREE_CODE (var) == SYMBOL_MEMORY_TAG
! 		  && is_call_site))
! 	    append_vdef (var);
! 	}
!       else
! 	{
! 	  /* Even if no aliases have been added, we still need to
! 	     establish def-use and use-def chains, lest
! 	     transformations think that this is not a memory
! 	     reference.  For an example of this scenario, see
! 	     testsuite/g++.dg/opt/cleanup1.C.  */
! 	  if (none_added)
! 	    append_vuse (var);
! 	}
!     }
  }
  
  
--- 1159,1169 ----
       ADDR_EXPR expression).  */
    if (flags & opf_no_vops)
      return;
  
!   if (flags & opf_def)
!     append_vdef ();
    else
!     append_vuse ();
  }
  
  
*************** add_stmt_operand (tree *var_p, gimple st
*** 1499,1607 ****
  	append_use (var_p);
      }
    else
-     add_virtual_operand (var, stmt, flags, NULL_TREE, 0, -1, false);
- }
- 
- /* Subroutine of get_indirect_ref_operands.  ADDR is the address
-    that is dereferenced, the meaning of the rest of the arguments
-    is the same as in get_indirect_ref_operands.  */
- 
- static void
- get_addr_dereference_operands (gimple stmt, tree *addr, int flags,
- 			       tree full_ref, HOST_WIDE_INT offset,
- 			       HOST_WIDE_INT size, bool recurse_on_base)
- {
-   tree ptr = *addr;
- 
-   /* Mark the statement as having memory operands.  */
-   gimple_set_references_memory (stmt, true);
- 
-   if (SSA_VAR_P (ptr))
      {
!       struct ptr_info_def *pi = NULL;
! 
!       /* If PTR has flow-sensitive points-to information, use it.  */
!       if (TREE_CODE (ptr) == SSA_NAME
! 	  && (pi = SSA_NAME_PTR_INFO (ptr)) != NULL
! 	  && pi->name_mem_tag)
  	{
! 	  /* PTR has its own memory tag.  Use it.  */
! 	  add_virtual_operand (pi->name_mem_tag, stmt, flags,
! 			       full_ref, offset, size, false);
! 	}
!       else
! 	{
! 	  /* If PTR is not an SSA_NAME or it doesn't have a name
! 	     tag, use its symbol memory tag.  */
! 	  var_ann_t v_ann;
! 
! 	  /* If we are emitting debugging dumps, display a warning if
! 	     PTR is an SSA_NAME with no flow-sensitive alias
! 	     information.  That means that we may need to compute
! 	     aliasing again or that a propagation pass forgot to
! 	     update the alias information on the pointers.  */
! 	  if (dump_file
! 	      && TREE_CODE (ptr) == SSA_NAME
! 	      && (pi == NULL
! 		  || (pi->name_mem_tag == NULL_TREE
! 		      && !pi->pt_anything))
! 	      && gimple_aliases_computed_p (cfun))
! 	    {
! 	      fprintf (dump_file,
! 		  "NOTE: no flow-sensitive alias info for ");
! 	      print_generic_expr (dump_file, ptr, dump_flags);
! 	      fprintf (dump_file, " in ");
! 	      print_gimple_stmt (dump_file, stmt, 0, 0);
! 	    }
! 
! 	  if (TREE_CODE (ptr) == SSA_NAME)
! 	    ptr = SSA_NAME_VAR (ptr);
! 	  v_ann = var_ann (ptr);
! 
! 	  /* If we don't know what this pointer points to then we have
! 	     to make sure to not prune virtual operands based on offset
! 	     and size.  */
! 	  if (v_ann->symbol_mem_tag)
! 	    {
! 	      add_virtual_operand (v_ann->symbol_mem_tag, stmt, flags,
! 				   full_ref, 0, -1, false);
! 	      /* Make sure we add the SMT itself.  */
! 	      if (!(flags & opf_no_vops))
! 		{
! 		  if (flags & opf_def)
! 		    append_vdef (v_ann->symbol_mem_tag);
! 		  else
! 		    append_vuse (v_ann->symbol_mem_tag);
! 		}
! 	    }
! 
! 	  /* Aliasing information is missing; mark statement as
! 	     volatile so we won't optimize it out too actively.  */
!           else if (!gimple_aliases_computed_p (cfun)
!                    && (flags & opf_def))
! 	    gimple_set_has_volatile_ops (stmt, true);
  	}
      }
-   else if (TREE_CODE (ptr) == INTEGER_CST)
-     {
-       /* If a constant is used as a pointer, we can't generate a real
- 	 operand for it but we mark the statement volatile to prevent
- 	 optimizations from messing things up.  */
-       gimple_set_has_volatile_ops (stmt, true);
-       return;
-     }
-   else
-     {
-       /* Ok, this isn't even is_gimple_min_invariant.  Something's broke.  */
-       gcc_unreachable ();
-     }
- 
-   /* If requested, add a USE operand for the base pointer.  */
-   if (recurse_on_base)
-     get_expr_operands (stmt, addr, opf_use);
  }
  
- 
  /* A subroutine of get_expr_operands to handle INDIRECT_REF,
     ALIGN_INDIRECT_REF and MISALIGNED_INDIRECT_REF.  
  
--- 1197,1215 ----
  	append_use (var_p);
      }
    else
      {
!       if (TREE_CODE (var) == VAR_DECL
! 	  || TREE_CODE (var) == PARM_DECL
! 	  || TREE_CODE (var) == RESULT_DECL)
  	{
! 	  if (flags & opf_def)
! 	    bitmap_set_bit (build_stores, DECL_UID (var));
! 	  bitmap_set_bit (build_loads, DECL_UID (var));
  	}
+       add_virtual_operand (stmt, flags);
      }
  }
  
  /* A subroutine of get_expr_operands to handle INDIRECT_REF,
     ALIGN_INDIRECT_REF and MISALIGNED_INDIRECT_REF.  
  
*************** get_addr_dereference_operands (gimple st
*** 1613,1628 ****
     FULL_REF contains the full pointer dereference expression, if we
        have it, or NULL otherwise.
  
-    OFFSET and SIZE are the location of the access inside the
-       dereferenced pointer, if known.
- 
     RECURSE_ON_BASE should be set to true if we want to continue
        calling get_expr_operands on the base pointer, and false if
        something else will do it for us.  */
  
  static void
! get_indirect_ref_operands (gimple stmt, tree expr, int flags, tree full_ref,
! 			   HOST_WIDE_INT offset, HOST_WIDE_INT size,
  			   bool recurse_on_base)
  {
    tree *pptr = &TREE_OPERAND (expr, 0);
--- 1221,1232 ----
     FULL_REF contains the full pointer dereference expression, if we
        have it, or NULL otherwise.
  
     RECURSE_ON_BASE should be set to true if we want to continue
        calling get_expr_operands on the base pointer, and false if
        something else will do it for us.  */
  
  static void
! get_indirect_ref_operands (gimple stmt, tree expr, int flags,
  			   bool recurse_on_base)
  {
    tree *pptr = &TREE_OPERAND (expr, 0);
*************** get_indirect_ref_operands (gimple stmt, 
*** 1630,1637 ****
    if (TREE_THIS_VOLATILE (expr))
      gimple_set_has_volatile_ops (stmt, true);
  
!   get_addr_dereference_operands (stmt, pptr, flags, full_ref, offset, size,
! 				 recurse_on_base);
  }
  
  
--- 1234,1248 ----
    if (TREE_THIS_VOLATILE (expr))
      gimple_set_has_volatile_ops (stmt, true);
  
!   /* Mark the statement as having memory operands.  */
!   gimple_set_references_memory (stmt, true);
! 
!   /* Add the VOP.  */
!   add_virtual_operand (stmt, flags);
! 
!   /* If requested, add a USE operand for the base pointer.  */
!   if (recurse_on_base)
!     get_expr_operands (stmt, pptr, opf_use);
  }
  
  
*************** get_indirect_ref_operands (gimple stmt, 
*** 1640,1647 ****
  static void
  get_tmr_operands (gimple stmt, tree expr, int flags)
  {
-   tree tag;
- 
    /* Mark the statement as having memory operands.  */
    gimple_set_references_memory (stmt, true);
  
--- 1251,1256 ----
*************** get_tmr_operands (gimple stmt, tree expr
*** 1652,1805 ****
    if (TMR_SYMBOL (expr))
      gimple_add_to_addresses_taken (stmt, TMR_SYMBOL (expr));
  
!   tag = TMR_TAG (expr);
!   if (!tag)
!     {
!       /* Something weird, so ensure that we will be careful.  */
!       gimple_set_has_volatile_ops (stmt, true);
!       return;
!     }
!   if (!MTAG_P (tag))
!     {
!       get_expr_operands (stmt, &tag, flags);
!       return;
!     }
! 
!   add_virtual_operand (tag, stmt, flags, expr, 0, -1, false);
! }
! 
! 
! /* Add clobbering definitions for .GLOBAL_VAR or for each of the call
!    clobbered variables in the function.  */
! 
! static void
! add_call_clobber_ops (gimple stmt, tree callee ATTRIBUTE_UNUSED)
! {
!   unsigned u;
!   bitmap_iterator bi;
!   bitmap not_read_b, not_written_b;
! 
!   gcc_assert (!(gimple_call_flags (stmt) & (ECF_PURE | ECF_CONST)));
! 
!   /* If we created .GLOBAL_VAR earlier, just use it.  */
!   if (gimple_global_var (cfun))
!     {
!       tree var = gimple_global_var (cfun);
!       add_virtual_operand (var, stmt, opf_def, NULL, 0, -1, true);
!       return;
!     }
! 
!   /* Get info for local and module level statics.  There is a bit
!      set for each static if the call being processed does not read
!      or write that variable.  */
!   not_read_b = callee ? ipa_reference_get_not_read_global (cgraph_node (callee)) : NULL; 
!   not_written_b = callee ? ipa_reference_get_not_written_global (cgraph_node (callee)) : NULL;
! 
!   /* Add a VDEF operand for every call clobbered variable.  */
!   EXECUTE_IF_SET_IN_BITMAP (gimple_call_clobbered_vars (cfun), 0, u, bi)
!     {
!       tree var = referenced_var_lookup (u);
!       tree real_var = var;
!       bool not_read;
!       bool not_written;
! 
!       not_read = not_read_b
! 	         ? bitmap_bit_p (not_read_b, DECL_UID (real_var))
! 	         : false;
! 
!       not_written = not_written_b
! 	            ? bitmap_bit_p (not_written_b, DECL_UID (real_var))
! 		    : false;
!       gcc_assert (!unmodifiable_var_p (var));
!       
!       clobber_stats.clobbered_vars++;
! 
!       /* See if this variable is really clobbered by this function.  */
! 
!       if (not_written)
! 	{
! 	  clobber_stats.static_write_clobbers_avoided++;
! 	  if (!not_read)
! 	    add_virtual_operand (var, stmt, opf_use, NULL, 0, -1, true);
! 	  else
! 	    clobber_stats.static_read_clobbers_avoided++;
! 	}
!       else
! 	add_virtual_operand (var, stmt, opf_def, NULL, 0, -1, true);
!     }
! }
! 
! 
! /* Add VUSE operands for .GLOBAL_VAR or all call clobbered variables in the
!    function.  */
! 
! static void
! add_call_read_ops (gimple stmt, tree callee ATTRIBUTE_UNUSED)
! {
!   unsigned u;
!   bitmap_iterator bi;
!   bitmap not_read_b;
! 
!   /* Const functions do not reference memory.  */
!   if (gimple_call_flags (stmt) & ECF_CONST)
!     return;
! 
!   not_read_b = callee ? ipa_reference_get_not_read_global (cgraph_node (callee)) : NULL;
! 
!   /* For pure functions we compute non-escaped uses separately.  */
!   if (gimple_call_flags (stmt) & ECF_PURE)
!     EXECUTE_IF_SET_IN_BITMAP (gimple_call_used_vars (cfun), 0, u, bi)
!       {
! 	tree var = referenced_var_lookup (u);
! 	tree real_var = var;
! 	bool not_read;
! 
! 	if (unmodifiable_var_p (var))
! 	  continue;
! 
! 	not_read = not_read_b
! 	    ? bitmap_bit_p (not_read_b, DECL_UID (real_var))
! 	    : false;
! 
! 	clobber_stats.readonly_clobbers++;
! 
! 	/* See if this variable is really used by this function.  */
! 	if (!not_read)
! 	  add_virtual_operand (var, stmt, opf_use, NULL, 0, -1, true);
! 	else
! 	  clobber_stats.static_readonly_clobbers_avoided++;
!       }
! 
!   /* Add a VUSE for .GLOBAL_VAR if it has been created.  See
!      add_referenced_var for the heuristic used to decide whether to
!      create .GLOBAL_VAR.  */
!   if (gimple_global_var (cfun))
!     {
!       tree var = gimple_global_var (cfun);
!       add_virtual_operand (var, stmt, opf_use, NULL, 0, -1, true);
!       return;
!     }
! 
!   /* Add a VUSE for each call-clobbered variable.  */
!   EXECUTE_IF_SET_IN_BITMAP (gimple_call_clobbered_vars (cfun), 0, u, bi)
!     {
!       tree var = referenced_var (u);
!       tree real_var = var;
!       bool not_read;
!       
!       clobber_stats.readonly_clobbers++;
! 
!       not_read = not_read_b ? bitmap_bit_p (not_read_b, DECL_UID (real_var))
! 	                    : false;
!       
!       if (not_read)
! 	{
! 	  clobber_stats.static_readonly_clobbers_avoided++;
! 	  continue;
! 	}
!             
!       add_virtual_operand (var, stmt, opf_use, NULL, 0, -1, true);
!     }
  }
  
  
--- 1261,1267 ----
    if (TMR_SYMBOL (expr))
      gimple_add_to_addresses_taken (stmt, TMR_SYMBOL (expr));
  
!   add_virtual_operand (stmt, flags);
  }
  
  
*************** add_call_read_ops (gimple stmt, tree cal
*** 1807,1813 ****
     escape, add them to the VDEF/VUSE lists for it.  */
  
  static void
! maybe_add_call_clobbered_vops (gimple stmt)
  {
    int call_flags = gimple_call_flags (stmt);
  
--- 1269,1275 ----
     escape, add them to the VDEF/VUSE lists for it.  */
  
  static void
! maybe_add_call_vops (gimple stmt)
  {
    int call_flags = gimple_call_flags (stmt);
  
*************** maybe_add_call_clobbered_vops (gimple st
*** 1817,1831 ****
    /* If aliases have been computed already, add VDEF or VUSE
       operands for all the symbols that have been found to be
       call-clobbered.  */
!   if (gimple_aliases_computed_p (cfun) && !(call_flags & ECF_NOVOPS))
      {
        /* A 'pure' or a 'const' function never call-clobbers anything. 
  	 A 'noreturn' function might, but since we don't return anyway 
  	 there is no point in recording that.  */ 
        if (!(call_flags & (ECF_PURE | ECF_CONST | ECF_NORETURN)))
! 	add_call_clobber_ops (stmt, gimple_call_fndecl (stmt));
        else if (!(call_flags & ECF_CONST))
! 	add_call_read_ops (stmt, gimple_call_fndecl (stmt));
      }
  }
  
--- 1279,1293 ----
    /* If aliases have been computed already, add VDEF or VUSE
       operands for all the symbols that have been found to be
       call-clobbered.  */
!   if (!(call_flags & ECF_NOVOPS))
      {
        /* A 'pure' or a 'const' function never call-clobbers anything. 
  	 A 'noreturn' function might, but since we don't return anyway 
  	 there is no point in recording that.  */ 
        if (!(call_flags & (ECF_PURE | ECF_CONST | ECF_NORETURN)))
! 	add_virtual_operand (stmt, opf_def);
        else if (!(call_flags & ECF_CONST))
! 	add_virtual_operand (stmt, opf_use);
      }
  }
  
*************** get_expr_operands (gimple stmt, tree *ex
*** 1974,1980 ****
  
      case ALIGN_INDIRECT_REF:
      case INDIRECT_REF:
!       get_indirect_ref_operands (stmt, expr, flags, expr, 0, -1, true);
        return;
  
      case TARGET_MEM_REF:
--- 1436,1442 ----
  
      case ALIGN_INDIRECT_REF:
      case INDIRECT_REF:
!       get_indirect_ref_operands (stmt, expr, flags, true);
        return;
  
      case TARGET_MEM_REF:
*************** get_expr_operands (gimple stmt, tree *ex
*** 1996,2003 ****
  	ref = get_ref_base_and_extent (expr, &offset, &size, &maxsize);
  	if (TREE_CODE (ref) == INDIRECT_REF)
  	  {
! 	    get_indirect_ref_operands (stmt, ref, flags, expr, offset,
! 		                       maxsize, false);
  	    flags |= opf_no_vops;
  	  }
  
--- 1458,1464 ----
  	ref = get_ref_base_and_extent (expr, &offset, &size, &maxsize);
  	if (TREE_CODE (ref) == INDIRECT_REF)
  	  {
! 	    get_indirect_ref_operands (stmt, ref, flags, false);
  	    flags |= opf_no_vops;
  	  }
  
*************** parse_ssa_operands (gimple stmt)
*** 2133,2139 ****
  
        /* Add call-clobbered operands, if needed.  */
        if (code == GIMPLE_CALL)
! 	maybe_add_call_clobbered_vops (stmt);
      }
  }
  
--- 1594,1600 ----
  
        /* Add call-clobbered operands, if needed.  */
        if (code == GIMPLE_CALL)
! 	maybe_add_call_vops (stmt);
      }
  }
  
*************** create_ssa_artificial_load_stmt (gimple 
*** 2342,2348 ****
    /* For each VDEF on the original statement, we want to create a
       VUSE of the VDEF result operand on the new statement.  */
    FOR_EACH_SSA_TREE_OPERAND (op, old_stmt, iter, SSA_OP_VDEF)
!     append_vuse (op);
  
    finalize_ssa_stmt_operands (new_stmt);
  
--- 1803,1809 ----
    /* For each VDEF on the original statement, we want to create a
       VUSE of the VDEF result operand on the new statement.  */
    FOR_EACH_SSA_TREE_OPERAND (op, old_stmt, iter, SSA_OP_VDEF)
!     append_vuse ();
  
    finalize_ssa_stmt_operands (new_stmt);
  
Index: gcc/tree-ssa-alias.c
===================================================================
*** gcc/tree-ssa-alias.c.orig	2008-11-23 20:40:41.000000000 +0100
--- gcc/tree-ssa-alias.c	2008-11-23 22:08:37.000000000 +0100
*************** static void setup_pointers_and_addressab
*** 242,248 ****
  static void update_alias_info (struct alias_info *);
  static void create_global_var (void);
  static void maybe_create_global_var (void);
- static void create_vop_var (void);
  static void set_pt_anything (tree);
  
  void debug_mp_info (VEC(mem_sym_stats_t,heap) *);
--- 242,247 ----
*************** compute_may_aliases (void)
*** 1749,1757 ****
    
    memset (&alias_stats, 0, sizeof (alias_stats));
  
-   if (!gimple_vop (cfun))
-     create_vop_var ();
- 
    /* Initialize aliasing information.  */
    ai = init_alias_info ();
  
--- 1748,1753 ----
*************** may_alias_p (tree ptr, alias_set_type me
*** 3085,3091 ****
  bool
  may_point_to_global_var (tree ptr)
  {
!   struct ptr_info_def *pi = SSA_NAME_PTR_INFO (ptr);
  
    /* If we do not have points-to information for this variable,
       we have to punt.  */
--- 3081,3094 ----
  bool
  may_point_to_global_var (tree ptr)
  {
!   struct ptr_info_def *pi;
! 
!   /* If we end up with a pointer constant here that may point
!      to global memory.  */
!   if (TREE_CODE (ptr) != SSA_NAME)
!     return true;
! 
!   pi = SSA_NAME_PTR_INFO (ptr);
  
    /* If we do not have points-to information for this variable,
       we have to punt.  */
*************** create_global_var (void)
*** 3385,3415 ****
  }
  
  
- /* Create the VOP variable, an artificial global variable to act as a
-    representative of all of the virtual operands FUD chain.  */
- 
- static void
- create_vop_var (void)
- {
-   tree global_var = build_decl (VAR_DECL, get_identifier (".MEM"),
-                                 void_type_node);
-   DECL_ARTIFICIAL (global_var) = 1;
-   TREE_READONLY (global_var) = 0;
-   DECL_EXTERNAL (global_var) = 1;
-   TREE_STATIC (global_var) = 1;
-   TREE_USED (global_var) = 1;
-   DECL_CONTEXT (global_var) = NULL_TREE;
-   TREE_THIS_VOLATILE (global_var) = 0;
-   TREE_ADDRESSABLE (global_var) = 0;
- 
-   create_var_ann (global_var);
-   mark_call_clobbered (global_var, ESCAPE_UNKNOWN);
-   add_referenced_var (global_var);
-   mark_sym_for_renaming (global_var);
-   cfun->gimple_df->vop = global_var;
- }
- 
- 
  /* Dump alias statistics on FILE.  */
  
  static void 
--- 3388,3393 ----
Index: gcc/tree-call-cdce.c
===================================================================
*** gcc/tree-call-cdce.c.orig	2008-11-23 20:35:41.000000000 +0100
--- gcc/tree-call-cdce.c	2008-11-23 21:44:30.000000000 +0100
*************** tree_call_cdce (void)
*** 906,911 ****
--- 906,914 ----
      {
        free_dominance_info (CDI_DOMINATORS);
        free_dominance_info (CDI_POST_DOMINATORS);
+       /* As we introduced new control-flow we need to insert PHI-nodes
+          for the call-clobbers of the remaining call.  */
+       mark_sym_for_renaming (gimple_vop (cfun));
        return (TODO_update_ssa | TODO_cleanup_cfg | TODO_ggc_collect 
                | TODO_remove_unused_locals);
      }
Index: gcc/tree-cfg.c
===================================================================
*** gcc/tree-cfg.c.orig	2008-11-23 20:40:42.000000000 +0100
--- gcc/tree-cfg.c	2008-11-23 21:44:30.000000000 +0100
*************** mark_virtual_ops_in_bb (basic_block bb)
*** 5600,5618 ****
      mark_virtual_ops_for_renaming (gsi_stmt (gsi));
  }
  
- /* Marks virtual operands of all statements in basic blocks BBS for
-    renaming.  */
- 
- static void
- mark_virtual_ops_in_region (VEC (basic_block,heap) *bbs)
- {
-   basic_block bb;
-   unsigned i;
- 
-   for (i = 0; VEC_iterate (basic_block, bbs, i, bb); i++)
-     mark_virtual_ops_in_bb (bb);
- }
- 
  /* Move basic block BB from function CFUN to function DEST_FN.  The
     block is moved out of the original linked list and placed after
     block AFTER in the new list.  Also, the block is removed from the
--- 5600,5605 ----
*************** move_sese_region_to_fn (struct function 
*** 5979,5989 ****
  
    pop_cfun ();
  
-   /* The ssa form for virtual operands in the source function will have to
-      be repaired.  We do not care for the real operands -- the sese region
-      must be closed with respect to those.  */
-   mark_virtual_ops_in_region (bbs);
- 
    /* Move blocks from BBS into DEST_CFUN.  */
    gcc_assert (VEC_length (basic_block, bbs) >= 2);
    after = dest_cfun->cfg->x_entry_block_ptr;
--- 5966,5971 ----
Index: gcc/omp-low.c
===================================================================
*** gcc/omp-low.c.orig	2008-11-23 20:40:40.000000000 +0100
--- gcc/omp-low.c	2008-11-23 21:44:30.000000000 +0100
*************** expand_omp_taskreg (struct omp_region *r
*** 3441,3446 ****
--- 3441,3448 ----
  	    cleanup_tree_cfg ();
  	  current_function_decl = save_current;
  	}
+       if (gimple_in_ssa_p (cfun))
+ 	update_ssa (TODO_update_ssa);
        pop_cfun ();
      }
    
Index: gcc/tree-ssa.c
===================================================================
*** gcc/tree-ssa.c.orig	2008-11-23 20:40:42.000000000 +0100
--- gcc/tree-ssa.c	2008-11-23 21:50:20.000000000 +0100
*************** execute_update_addresses_taken (void)
*** 1680,1686 ****
    basic_block bb;
    bitmap addresses_taken = BITMAP_ALLOC (NULL);
    bitmap not_reg_needs = BITMAP_ALLOC (NULL);
-   bitmap vars_updated = BITMAP_ALLOC (NULL);
    bool update_vops = false;
  
    /* Collect into ADDRESSES_TAKEN all variables whose address is taken within
--- 1680,1685 ----
*************** execute_update_addresses_taken (void)
*** 1743,1749 ****
  	  if (is_gimple_reg (var))
  	    mark_sym_for_renaming (var);
  	  update_vops = true;
- 	  bitmap_set_bit (vars_updated, DECL_UID (var));
  	  if (dump_file)
  	    {
  	      fprintf (dump_file, "No longer having address taken ");
--- 1742,1747 ----
*************** execute_update_addresses_taken (void)
*** 1759,1765 ****
  	  DECL_GIMPLE_REG_P (var) = 1;
  	  mark_sym_for_renaming (var);
  	  update_vops = true;
- 	  bitmap_set_bit (vars_updated, DECL_UID (var));
  	  if (dump_file)
  	    {
  	      fprintf (dump_file, "Decl is now a gimple register ");
--- 1757,1762 ----
*************** execute_update_addresses_taken (void)
*** 1777,1791 ****
  	{
  	  gimple stmt = gsi_stmt (gsi);
  
! 	  if ((gimple_loaded_syms (stmt)
! 	       && bitmap_intersect_p (gimple_loaded_syms (stmt), vars_updated))
! 	      || (gimple_stored_syms (stmt)
! 		  && bitmap_intersect_p (gimple_stored_syms (stmt), vars_updated)))
  	    update_stmt (stmt);
  	}
    BITMAP_FREE (not_reg_needs);
    BITMAP_FREE (addresses_taken);
-   BITMAP_FREE (vars_updated);
    return 0;
  }
  
--- 1774,1784 ----
  	{
  	  gimple stmt = gsi_stmt (gsi);
  
! 	  if (gimple_references_memory_p (stmt))
  	    update_stmt (stmt);
  	}
    BITMAP_FREE (not_reg_needs);
    BITMAP_FREE (addresses_taken);
    return 0;
  }
  


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