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] Fix SCCVN to be able to run after ivopts


We didn't expect TARGET_MEM_REF.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

Richard.

2008-05-15  Richard Guenther  <rguenther@suse.de>

	* tree-dfa.c (refs_may_alias_p): Allow all kinds of
	INDIRECT_REF and TARGET_MEM_REF.
	* tree-ssa-sccvn.c (copy_reference_ops_from_ref): Handle
	TARGET_MEM_REF.

Index: gcc/tree-dfa.c
===================================================================
*** gcc/tree-dfa.c.orig	2008-05-08 15:25:46.000000000 +0200
--- gcc/tree-dfa.c	2008-05-13 17:43:53.000000000 +0200
*************** refs_may_alias_p (tree ref1, tree ref2)
*** 996,1005 ****
  
    gcc_assert ((SSA_VAR_P (ref1)
  	       || handled_component_p (ref1)
! 	       || TREE_CODE (ref1) == INDIRECT_REF)
  	      && (SSA_VAR_P (ref2)
  		  || handled_component_p (ref2)
! 		  || TREE_CODE (ref2) == INDIRECT_REF));
  
    /* Defer to TBAA if possible.  */
    if (flag_strict_aliasing
--- 996,1007 ----
  
    gcc_assert ((SSA_VAR_P (ref1)
  	       || handled_component_p (ref1)
! 	       || INDIRECT_REF_P (ref1)
! 	       || TREE_CODE (ref1) == TARGET_MEM_REF)
  	      && (SSA_VAR_P (ref2)
  		  || handled_component_p (ref2)
! 		  || INDIRECT_REF_P (ref2)
! 		  || TREE_CODE (ref2) == TARGET_MEM_REF));
  
    /* Defer to TBAA if possible.  */
    if (flag_strict_aliasing
Index: gcc/tree-ssa-sccvn.c
===================================================================
*** gcc/tree-ssa-sccvn.c.orig	2008-05-13 15:03:14.000000000 +0200
--- gcc/tree-ssa-sccvn.c	2008-05-13 17:40:45.000000000 +0200
*************** copy_reference_ops_from_ref (tree ref, V
*** 504,509 ****
--- 504,530 ----
        return;
      }
  
+   if (TREE_CODE (ref) == TARGET_MEM_REF)
+     {
+       vn_reference_op_s temp;
+ 
+       memset (&temp, 0, sizeof (temp));
+       /* We do not care for spurious type qualifications.  */
+       temp.type = TYPE_MAIN_VARIANT (TREE_TYPE (ref));
+       temp.opcode = TREE_CODE (ref);
+       temp.op0 = TMR_SYMBOL (ref) ? TMR_SYMBOL (ref) : TMR_BASE (ref);
+       temp.op1 = TMR_INDEX (ref);
+       VEC_safe_push (vn_reference_op_s, heap, *result, &temp);
+ 
+       memset (&temp, 0, sizeof (temp));
+       temp.type = NULL_TREE;
+       temp.opcode = TREE_CODE (ref);
+       temp.op0 = TMR_STEP (ref);
+       temp.op1 = TMR_OFFSET (ref);
+       VEC_safe_push (vn_reference_op_s, heap, *result, &temp);
+       return;
+     }
+ 
    /* For non-calls, store the information that makes up the address.  */
  
    while (ref)


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