diff mbox

Fix PR tree-optimization/50727

Message ID CAKSNEw4M5ufUotwtvKfTZRp31QhyLy8TDktooD2pT=xv58P+Tg@mail.gmail.com
State New
Headers show

Commit Message

Ira Rosen Oct. 16, 2011, 1:48 p.m. UTC
Hi,

This patch fixes another occurrence of the same bug as in PR 50635.

Bootstrapped and tested on powerpc64-suse-linux.
Committed.

Ira

ChangeLog:

        PR tree-optimization/50727
        * tree-vect-patterns.c (vect_operation_fits_smaller_type): Add
        DEF_STMT to the list of statements to be replaced by the
        pattern statements.

testsuite/ChangeLog:

        PR tree-optimization/50727
        * gcc.dg/vect/pr50727.c: New test.
diff mbox

Patch

Index: testsuite/gcc.dg/vect/pr50727.c
===================================================================
--- testsuite/gcc.dg/vect/pr50727.c     (revision 0)
+++ testsuite/gcc.dg/vect/pr50727.c     (revision 0)
@@ -0,0 +1,21 @@ 
+/* { dg-do compile } */
+
+typedef unsigned char uint8_t;
+typedef unsigned long uint32_t;
+void
+f0a (uint32_t * __restrict__ result, uint32_t * arg2,
+     uint8_t * __restrict__ arg4)
+{
+  int idx;
+  for (idx = 0; idx < 429; idx += 1)
+    {
+      uint32_t temp_9;
+      uint32_t temp_11;
+      temp_9 = ((-19 | arg4[idx]) >> arg2[idx]);
+      temp_11 = (((-19 ^ arg4[idx]) & arg2[idx]) ^ temp_9);
+      result[idx] = temp_11;
+    }
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
Index: tree-vect-patterns.c
===================================================================
--- tree-vect-patterns.c        (revision 180054)
+++ tree-vect-patterns.c        (working copy)
@@ -1001,6 +1001,7 @@  vect_operation_fits_smaller_type (gimple stmt, tre
                   || TREE_TYPE (gimple_assign_lhs (new_stmt)) != interm_type)
                 return false;

+             VEC_safe_push (gimple, heap, *stmts, def_stmt);
               oprnd = gimple_assign_lhs (new_stmt);
             }
           else