public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/65504] [4.9/5 Regression] select case with strings and -fgcse -O
Date: Mon, 23 Mar 2015 13:02:00 -0000	[thread overview]
Message-ID: <bug-65504-4-x7JjhZO11d@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-65504-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65504

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #16 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
--- gcc/config/i386/i386.c.jj    2015-03-23 08:47:53.000000000 +0100
+++ gcc/config/i386/i386.c    2015-03-23 13:11:43.416147457 +0100
@@ -23457,12 +23457,19 @@ counter_mode (rtx count_exp)
 static rtx
 ix86_copy_addr_to_reg (rtx addr)
 {
+  rtx reg;
   if (GET_MODE (addr) == Pmode || GET_MODE (addr) == VOIDmode)
-    return copy_addr_to_reg (addr);
+    {
+      reg = copy_addr_to_reg (addr);
+      REG_POINTER (reg) = 1;
+      return reg;
+    }
   else
     {
       gcc_assert (GET_MODE (addr) == DImode && Pmode == SImode);
-      return gen_rtx_SUBREG (SImode, copy_to_mode_reg (DImode, addr), 0);
+      reg = copy_to_mode_reg (DImode, addr);
+      REG_POINTER (reg) = 1;
+      return gen_rtx_SUBREG (SImode, reg, 0);
     }
 }

@@ -24354,6 +24361,8 @@ expand_set_or_movmem_prologue_epilogue_b
       *destptr = expand_simple_binop (GET_MODE (*destptr), PLUS, *destptr,
                       GEN_INT (prolog_size),
                       NULL_RTX, 1, OPTAB_DIRECT);
+      if (REG_P (*destptr) && REG_P (saveddest) && REG_POINTER (*saveddest))
+    REG_POINTER (*destptr) = 1;
       *destptr = expand_simple_binop (GET_MODE (*destptr), AND, *destptr,
                       GEN_INT (-desired_align),
                       *destptr, 1, OPTAB_DIRECT);
@@ -24363,8 +24372,8 @@ expand_set_or_movmem_prologue_epilogue_b
                        saveddest, 1, OPTAB_DIRECT);
       /* Adjust srcptr and count.  */
       if (!issetmem)
-    *srcptr = expand_simple_binop (GET_MODE (*srcptr), MINUS, *srcptr,
saveddest,
-                    *srcptr, 1, OPTAB_DIRECT);
+    *srcptr = expand_simple_binop (GET_MODE (*srcptr), MINUS, *srcptr,
+                       saveddest, *srcptr, 1, OPTAB_DIRECT);
       *count = expand_simple_binop (GET_MODE (*count), PLUS, *count,
                     saveddest, *count, 1, OPTAB_DIRECT);
       /* We copied at most size + prolog_size.  */

fixes this for me.  Without the REG_POINTER flags, aliasing is really confused
on what is a pointer and what is not, as the prologue of the misaligned memcpy
uses
adjusteddest = dest & -align;
src = src - (adjusteddest - dest)
and from these only one has REG_POINTER flag after the propagation, so aliasing
makes a wrong decision from that.


  parent reply	other threads:[~2015-03-23 12:21 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-21 13:19 [Bug middle-end/65504] New: " tkoenig at gcc dot gnu.org
2015-03-21 13:54 ` [Bug middle-end/65504] " tkoenig at gcc dot gnu.org
2015-03-21 14:10 ` [Bug rtl-optimization/65504] " tkoenig at gcc dot gnu.org
2015-03-21 14:40 ` dominiq at lps dot ens.fr
2015-03-21 14:56 ` tkoenig at gcc dot gnu.org
2015-03-21 15:12 ` tkoenig at gcc dot gnu.org
2015-03-21 15:15 ` howarth at bromo dot med.uc.edu
2015-03-21 15:24 ` howarth at bromo dot med.uc.edu
2015-03-21 15:45 ` dominiq at lps dot ens.fr
2015-03-21 15:59 ` tkoenig at gcc dot gnu.org
2015-03-21 18:30 ` howarth at bromo dot med.uc.edu
2015-03-21 18:38 ` howarth at bromo dot med.uc.edu
2015-03-21 18:42 ` howarth at bromo dot med.uc.edu
2015-03-21 20:14 ` sebastian.beyer at riseup dot net
2015-03-21 20:41 ` hjl.tools at gmail dot com
2015-03-21 22:23 ` ebotcazou at gcc dot gnu.org
2015-03-22 18:52 ` ebotcazou at gcc dot gnu.org
2015-03-23  9:57 ` rguenth at gcc dot gnu.org
2015-03-23 13:02 ` [Bug target/65504] " jakub at gcc dot gnu.org
2015-03-23 13:02 ` jakub at gcc dot gnu.org [this message]
2015-03-23 13:51 ` ebotcazou at gcc dot gnu.org
2015-03-23 14:18 ` jakub at gcc dot gnu.org
2015-03-23 15:45 ` jakub at gcc dot gnu.org
2015-03-23 15:49 ` [Bug target/65504] [4.9 " jakub at gcc dot gnu.org
2015-06-03 15:31 ` jakub at gcc dot gnu.org
2015-06-03 21:43 ` jakub at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-65504-4-x7JjhZO11d@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).