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] new memory model: fix scheduling


This fixes (haifa) scheduling in the context of adjusting the GCC
memory model to correctly follow the C and C++ standards.  It also
fixes the tramp3d segfaults I currently see on our testers where
I managed to break the fragile CHANGE_DYNAMIC_TYPE_EXPR stuff enough
to make the scheduler reorder the wrong stuff.

Neither anti-dependence nor output-dependence may use type-based
disambiguations to disprove a dependency.  This is because a store
(in case of C only a store to memory without a declared type) will
change the effective type of the memory for further loads.

The selective scheduler doesn't seem to use alias.c dependence
functions - maybe someone who knows the selective scheduler can
hint at the right place to look or adjust the scheduler himself.

What remains to be fixed / looked after is store motion both on
the tree level and on the RTL level (where it may be ok already,
as it uses the alias.c functions for dependence analysis) as well
as loop distribution.  And of course documenting the memory model
the middle-end relies upon.

I am queuing this patch for now.

Thanks,
Richard.

2009-05-05  Richard Guenther  <rguenther@suse.de>

	PR middle-end/38964
	* alias.c (write_dependence_p): Do not use TBAA for answering
	anti-dependence or output-dependence.

Index: gcc/alias.c
===================================================================
*** gcc/alias.c	(revision 147093)
--- gcc/alias.c	(working copy)
*************** write_dependence_p (const_rtx mem, const
*** 2373,2381 ****
        || MEM_ALIAS_SET (mem) == ALIAS_SET_MEMORY_BARRIER)
      return 1;
  
-   if (DIFFERENT_ALIAS_SETS_P (x, mem))
-     return 0;
- 
    /* A read from read-only memory can't conflict with read-write memory.  */
    if (!writep && MEM_READONLY_P (mem))
      return 0;
--- 2373,2378 ----


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