This is the mail archive of the
mailing list for the GCC project.
[PATCH] new memory model: fix scheduling
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 5 May 2009 16:18:48 +0200 (CEST)
- Subject: [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.
2009-05-05 Richard Guenther <email@example.com>
* alias.c (write_dependence_p): Do not use TBAA for answering
anti-dependence or output-dependence.
*** 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)
- 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))
--- 2373,2378 ----