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][RFC] alias.c TLC


This removes some odd code from true_dependence_1 and may_alias_p that
is not in write_dependence - namely special-casing of AND as
alias-everything (and the function doing the same named 
aliases_everything_p).  It also makes BLKmode SCRATCH handling
consistent between both and removes special casing of general
BLKmode handling from true_dependence_1.  In both cases we only
dispatch to rtx_refs_may_alias_p after that which is not
confused by either.

Bootstrapped and tested on x86_64-unknown-linux-gnu.

I'm leaving it for comments until next Monday.

Thanks,
Richard.

2012-06-06  Richard Guenther  <rguenther@suse.de>

	* alias.c (aliases_everything_p): Remove.
	(DIFFERENT_ALIAS_SETS_P): Likewise.
	(true_dependence_1): Use mems_in_disjoint_alias_sets_p directly.
	Do not use aliases_everything_p or special-case ANDs.  Do not
	special-case BLKmode moves.
	(may_alias_p): Likewise.  Handle BLKmode similar like everywhere
	- for SCATCH only.  

Index: gcc/alias.c
===================================================================
*** gcc/alias.c	(revision 188263)
--- gcc/alias.c	(working copy)
*************** static rtx find_base_value (rtx);
*** 156,162 ****
  static int mems_in_disjoint_alias_sets_p (const_rtx, const_rtx);
  static int insert_subset_children (splay_tree_node, void*);
  static alias_set_entry get_alias_set_entry (alias_set_type);
- static int aliases_everything_p (const_rtx);
  static bool nonoverlapping_component_refs_p (const_tree, const_tree);
  static tree decl_for_component_ref (tree);
  static int write_dependence_p (const_rtx, const_rtx, int);
--- 156,161 ----
*************** static void memory_modified_1 (rtx, cons
*** 168,180 ****
  /* Returns the size in bytes of the mode of X.  */
  #define SIZE_FOR_MODE(X) (GET_MODE_SIZE (GET_MODE (X)))
  
- /* Returns nonzero if MEM1 and MEM2 do not alias because they are in
-    different alias sets.  We ignore alias sets in functions making use
-    of variable arguments because the va_arg macros on some systems are
-    not legal ANSI C.  */
- #define DIFFERENT_ALIAS_SETS_P(MEM1, MEM2)			\
-   mems_in_disjoint_alias_sets_p (MEM1, MEM2)
- 
  /* Cap the number of passes we make over the insns propagating alias
     information through set chains.   10 is a completely arbitrary choice.  */
  #define MAX_ALIAS_LOOP_PASSES 10
--- 167,172 ----
*************** read_dependence (const_rtx mem, const_rt
*** 2188,2207 ****
    return MEM_VOLATILE_P (x) && MEM_VOLATILE_P (mem);
  }
  
- /* Returns nonzero if something about the mode or address format MEM1
-    indicates that it might well alias *anything*.  */
- 
- static int
- aliases_everything_p (const_rtx mem)
- {
-   if (GET_CODE (XEXP (mem, 0)) == AND)
-     /* If the address is an AND, it's very hard to know at what it is
-        actually pointing.  */
-     return 1;
- 
-   return 0;
- }
- 
  /* Return true if we can determine that the fields referenced cannot
     overlap for any pair of objects.  */
  
--- 2180,2185 ----
*************** true_dependence_1 (const_rtx mem, enum m
*** 2535,2559 ****
  				 SIZE_FOR_MODE (x), x_addr, 0)) != -1)
      return ret;
  
!   if (DIFFERENT_ALIAS_SETS_P (x, mem))
      return 0;
  
    if (nonoverlapping_memrefs_p (mem, x, false))
      return 0;
  
-   if (aliases_everything_p (x))
-     return 1;
- 
-   /* We cannot use aliases_everything_p to test MEM, since we must look
-      at MEM_ADDR, rather than XEXP (mem, 0).  */
-   if (GET_CODE (mem_addr) == AND)
-     return 1;
- 
-   /* ??? In true_dependence we also allow BLKmode to alias anything.  Why
-      don't we do this in anti_dependence and output_dependence?  */
-   if (mem_mode == BLKmode || GET_MODE (x) == BLKmode)
-     return 1;
- 
    return rtx_refs_may_alias_p (x, mem, true);
  }
  
--- 2513,2524 ----
  				 SIZE_FOR_MODE (x), x_addr, 0)) != -1)
      return ret;
  
!   if (mems_in_disjoint_alias_sets_p (x, mem))
      return 0;
  
    if (nonoverlapping_memrefs_p (mem, x, false))
      return 0;
  
    return rtx_refs_may_alias_p (x, mem, true);
  }
  
*************** may_alias_p (const_rtx mem, const_rtx x)
*** 2680,2689 ****
    if (MEM_VOLATILE_P (x) && MEM_VOLATILE_P (mem))
      return 1;
  
!   /* ??? In true_dependence we also allow BLKmode to alias anything. */
!   if (GET_MODE (mem) == BLKmode || GET_MODE (x) == BLKmode)
      return 1;
-     
    if (MEM_ALIAS_SET (x) == ALIAS_SET_MEMORY_BARRIER
        || MEM_ALIAS_SET (mem) == ALIAS_SET_MEMORY_BARRIER)
      return 1;
--- 2645,2656 ----
    if (MEM_VOLATILE_P (x) && MEM_VOLATILE_P (mem))
      return 1;
  
!   /* (mem:BLK (scratch)) is a special mechanism to conflict with everything.
!      This is used in epilogue deallocation functions.  */
!   if (GET_MODE (x) == BLKmode && GET_CODE (XEXP (x, 0)) == SCRATCH)
!     return 1;
!   if (GET_MODE (mem) == BLKmode && GET_CODE (XEXP (mem, 0)) == SCRATCH)
      return 1;
    if (MEM_ALIAS_SET (x) == ALIAS_SET_MEMORY_BARRIER
        || MEM_ALIAS_SET (mem) == ALIAS_SET_MEMORY_BARRIER)
      return 1;
*************** may_alias_p (const_rtx mem, const_rtx x)
*** 2722,2735 ****
    if (nonoverlapping_memrefs_p (mem, x, true))
      return 0;
  
-   if (aliases_everything_p (x))
-     return 1;
- 
-   /* We cannot use aliases_everything_p to test MEM, since we must look
-      at MEM_ADDR, rather than XEXP (mem, 0).  */
-   if (GET_CODE (mem_addr) == AND)
-     return 1;
- 
    /* TBAA not valid for loop_invarint */
    return rtx_refs_may_alias_p (x, mem, false);
  }
--- 2689,2694 ----


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