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/64286] Redundant extend removal ignores vector element type
Date: Fri, 09 Jan 2015 17:20:00 -0000	[thread overview]
Message-ID: <bug-64286-4-ExuUz5hcOM@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-64286-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Untested patch (just tried it on the testcase so far).

Trying to reduce the testcase now.

--- gcc/ree.c.jj    2015-01-05 13:07:15.000000000 +0100
+++ gcc/ree.c    2015-01-09 18:08:30.820754926 +0100
@@ -1021,6 +1021,7 @@ add_removable_extension (const_rtx expr,
      different extension.  FIXME: this obviously can be improved.  */
       for (def = defs; def; def = def->next)
     if ((idx = def_map[INSN_UID (DF_REF_INSN (def->ref))])
+        && idx != -1U
         && (cand = &(*insn_list)[idx - 1])
         && cand->code != code)
       {
@@ -1032,6 +1033,51 @@ add_removable_extension (const_rtx expr,
           }
         return;
       }
+    else if (VECTOR_MODE_P (GET_MODE (XEXP (src, 0))))
+      {
+        if (idx == 0)
+          {
+        struct df_link *ref_chain, *ref_link;
+
+        ref_chain = DF_REF_CHAIN (def->ref);
+        for (ref_link = ref_chain; ref_link; ref_link = ref_link->next)
+          {
+            if (ref_link->ref == NULL
+            || DF_REF_INSN_INFO (ref_link->ref) == NULL)
+              {
+            idx = -1U;
+            break;
+              }
+            rtx_insn *use_insn = DF_REF_INSN (ref_link->ref);
+            const_rtx use_set;
+            if (use_insn == insn || DEBUG_INSN_P (use_insn))
+              continue;
+            if (!(use_set = single_set (use_insn))
+            || !REG_P (SET_DEST (use_set))
+            || GET_MODE (SET_DEST (use_set)) != GET_MODE (dest)
+            || GET_CODE (SET_SRC (use_set)) != code
+            || !rtx_equal_p (XEXP (SET_SRC (use_set), 0),
+                     XEXP (src, 0)))
+              {
+            idx = -1U;
+            break;
+              }
+          }
+        if (idx == -1U)
+          def_map[INSN_UID (DF_REF_INSN (def->ref))] = idx;
+          }
+        if (idx == -1U)
+          {
+        if (dump_file)
+          {
+            fprintf (dump_file, "Cannot eliminate extension:\n");
+            print_rtl_single (dump_file, insn);
+            fprintf (dump_file,
+                 " because some vector uses aren't extension\n");
+          }
+        return;
+          }
+      }

       /* Then add the candidate to the list and insert the reaching
definitions
          into the definition map.  */


  parent reply	other threads:[~2015-01-09 17:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-12 13:11 [Bug rtl-optimization/64286] New: " sergos.gnu at gmail dot com
2015-01-09  7:08 ` [Bug rtl-optimization/64286] " law at redhat dot com
2015-01-09 16:06 ` jakub at gcc dot gnu.org
2015-01-09 17:20 ` jakub at gcc dot gnu.org [this message]
2015-01-09 17:57 ` jakub at gcc dot gnu.org
2015-01-12 11:33 ` jakub at gcc dot gnu.org
2015-01-12 11:35 ` [Bug rtl-optimization/64286] [4.9/5 Regression] " jakub at gcc dot gnu.org
2015-01-13 10:16 ` rguenth at gcc dot gnu.org
2015-01-13 19:13 ` jakub at gcc dot gnu.org
2015-01-13 19:15 ` [Bug rtl-optimization/64286] [4.9 " jakub at gcc dot gnu.org
2015-01-14 20:24 ` jakub at gcc dot gnu.org
2015-06-26 20:07 ` jakub at gcc dot gnu.org
2015-06-26 20:36 ` 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-64286-4-ExuUz5hcOM@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).