This is the mail archive of the gcc-bugs@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]

[Bug rtl-optimization/64286] Redundant extend removal ignores vector element type


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.  */


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