This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: PR middle-end/43671: [4.4/4.5/4.6 Regression] -fsched2-use-superblocks -m32 produces wrong code with vectorization
On Tue, May 4, 2010 at 9:15 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Tue, May 04, 2010 at 06:02:42PM +0200, Richard Guenther wrote:
>> On Tue, May 4, 2010 at 6:07 PM, Jakub Jelinek <jakub@redhat.com> wrote:
>> > On Tue, May 04, 2010 at 06:36:40AM -0700, H.J. Lu wrote:
>> > Two comments:
>> > 1) I guess something similar should be done also in memrefs_conflict_p
>> > ? - there it currently avoids doing get_addr only if either the VALUE
>> > ? is the same on both sides, or if one side has a VALUE and another
>> > ? a REG that has that VALUE currently. ?Perhaps also not doing
>> > ? get_addr if the other side is an expression involving that VALUE
>> > ? would be helpful.
>>
>> I think memrefs_conflict_p only disambiguates must-aliases (with
>> same bases), so it should be safe. ?But maybe I misremember.
>
> Yes, it does. ?In the memrefs_conflict_p case doing that could just improve
> generated code. ?See
> http://gcc.gnu.org/ml/gcc-patches/2010-04/msg00951.html
>
>
Do you have a testcase for this change? It may be replaced by this patch.
--
H.J.
--
diff --git a/gcc/alias.c b/gcc/alias.c
index 1d69d9d..42c77d6 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -1787,41 +1787,15 @@ addr_side_effect_eval (rtx addr, int size, int n_refs)
static int
memrefs_conflict_p (int xsize, rtx x, int ysize, rtx y, HOST_WIDE_INT c)
{
- if (GET_CODE (x) == VALUE)
+ if (!((GET_CODE (x) == VALUE
+ && GET_CODE (y) != VALUE
+ && reg_mentioned_p (x, y))
+ || (GET_CODE (x) != VALUE
+ && GET_CODE (y) == VALUE
+ && reg_mentioned_p (y, x))))
{
- if (REG_P (y))
- {
- struct elt_loc_list *l = NULL;
- if (CSELIB_VAL_PTR (x))
- for (l = CSELIB_VAL_PTR (x)->locs; l; l = l->next)
- if (REG_P (l->loc) && rtx_equal_for_memref_p (l->loc, y))
- break;
- if (l)
- x = y;
- else
- x = get_addr (x);
- }
- /* Don't call get_addr if y is the same VALUE. */
- else if (x != y)
- x = get_addr (x);
- }
- if (GET_CODE (y) == VALUE)
- {
- if (REG_P (x))
- {
- struct elt_loc_list *l = NULL;
- if (CSELIB_VAL_PTR (y))
- for (l = CSELIB_VAL_PTR (y)->locs; l; l = l->next)
- if (REG_P (l->loc) && rtx_equal_for_memref_p (l->loc, x))
- break;
- if (l)
- y = x;
- else
- y = get_addr (y);
- }
- /* Don't call get_addr if x is the same VALUE. */
- else if (y != x)
- y = get_addr (y);
+ x = get_addr (x);
+ y = get_addr (y);
}
if (GET_CODE (x) == HIGH)
x = XEXP (x, 0);