[PATCH] Fix IVOPTs problem

Zdenek Dvorak rakdver@atrey.karlin.mff.cuni.cz
Mon Aug 15 17:34:00 GMT 2005


Hello,

> > > On Fri, 2005-08-05 at 11:48 +0200, Richard Guenther wrote:
> > > > Compiling gcc.c-torture/execute/20010910-1.c with IVOPTs enabled
> > > > leads to ssa verification failures because 
> > > > tree-ssa-loop-ivopts.c:rewrite_use does not update ssa form
> > > > (it calls update_stmt but misses mark_new_vars_to_rename).
> > > But are the transformations performed by ivopts supposed to
> > > be changing the aliasing information?
> > 
> > no, ivopts should not change virtual operands of any statement.  So
> > there is indeed a bug in ivopts, but this is not the right fix.
> After further investigation and the ongoing discussion, I would have
> to disagree with you.
>
> Fundamentally IVOPTS has taken an array/structure access and turned
> it into pointer arithmetic, and in this particular case there isn't
> enough information carried in the TARGET_MEM_REF to determine that
> the TARGET_MEM_REF can't access the rx_ring field within the
> epic_private structure.

the right solution is to ensure that there is enough information in the
TARGET_MEM_REF.  We do not really want to lose precision of alias
analysis results just because we are unable to represent them.

The solution I would like the best would be to have the set of virtual
operands of the original expression stored in TARGET_MEM_REF.  I am
working on this, but it will take some time.

Anyway, as a workaroud for the Richard's problem, I think using
TMR_ORIGINAL might be sufficient.  I.e. something like this might work
(completely untested):

Index: tree-ssa-loop-ivopts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-loop-ivopts.c,v
retrieving revision 2.85
diff -c -3 -p -r2.85 tree-ssa-loop-ivopts.c
*** tree-ssa-loop-ivopts.c	21 Jul 2005 07:24:10 -0000	2.85
--- tree-ssa-loop-ivopts.c	15 Aug 2005 17:27:13 -0000
*************** unshare_and_remove_ssa_names (tree ref)
*** 5428,5437 ****
     and extracts this single useful piece of information.  */
  
  static tree
! get_ref_tag (tree ref)
  {
    tree var = get_base_address (ref);
    tree tag;
  
    if (!var)
      return NULL_TREE;
--- 5428,5441 ----
     and extracts this single useful piece of information.  */
  
  static tree
! get_ref_tag (tree ref, tree orig)
  {
    tree var = get_base_address (ref);
    tree tag;
+   unsigned HOST_WIDE_INT offset, size;
+ 
+   if (okay_component_ref_for_subvars (ref, &offset, &size))
+     return orig;
  
    if (!var)
      return NULL_TREE;
*************** copy_ref_info (tree new_ref, tree old_re
*** 5471,5478 ****
      copy_mem_ref_info (new_ref, old_ref);
    else
      {
-       TMR_TAG (new_ref) = get_ref_tag (old_ref);
        TMR_ORIGINAL (new_ref) = unshare_and_remove_ssa_names (old_ref);
      }
  }
  
--- 5475,5482 ----
      copy_mem_ref_info (new_ref, old_ref);
    else
      {
        TMR_ORIGINAL (new_ref) = unshare_and_remove_ssa_names (old_ref);
+       TMR_TAG (new_ref) = get_ref_tag (old_ref, TMR_ORIGINAL (new_ref));
      }
  }
  
Zdenek



More information about the Gcc-patches mailing list