diff mbox

Fix PR tree-optimization/50039

Message ID CAKSNEw5_SwRZ-gEiYd33bE5vOJ4Hc37aLoZh-03xbJoURSW9Ng@mail.gmail.com
State New
Headers show

Commit Message

Ira Rosen Aug. 11, 2011, 5:43 a.m. UTC
Hi,

This patch adds a check in vect_operation_fits_smaller_type ()  that a
widening statement has a stmt_vec_info, i.e., that it is a loop
statement.

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

Ira

ChangeLog:

    PR tree-optimization/50039
    * tree-vect-patterns.c (vect_operation_fits_smaller_type): Check
    that DEF_STMT has a stmt_vec_info.

testsuite/ChangeLog:

    PR tree-optimization/50039
    * gcc.dg/vect/vect.exp: Run no-tree-fre-* tests with -fno-tree-fre.
    * gcc.dg/vect/no-tree-fre-pr50039.c: New test.
diff mbox

Patch

Index: testsuite/gcc.dg/vect/vect.exp
===================================================================
--- testsuite/gcc.dg/vect/vect.exp      (revision 177646)
+++ testsuite/gcc.dg/vect/vect.exp      (working copy)
@@ -257,6 +257,12 @@  lappend VECT_SLP_CFLAGS "-fno-tree-reassoc"
 dg-runtest [lsort [glob -nocomplain
$srcdir/$subdir/no-tree-reassoc-bb-slp-*.\[cS\]]]  \
         "" $VECT_SLP_CFLAGS

+# -fno-tree-fre
+set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS
+lappend DEFAULT_VECTCFLAGS "-fno-tree-fre"
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-tree-fre-*.\[cS\]]]  \
+        "" $DEFAULT_VECTCFLAGS
+
 # Clean up.
 set dg-do-what-default ${save-dg-do-what-default}

Index: testsuite/gcc.dg/vect/no-tree-fre-pr50039.c
===================================================================
--- testsuite/gcc.dg/vect/no-tree-fre-pr50039.c (revision 0)
+++ testsuite/gcc.dg/vect/no-tree-fre-pr50039.c (revision 0)
@@ -0,0 +1,15 @@ 
+/* { dg-do compile } */
+
+extern unsigned char g_5;
+extern int g_31, g_76;
+int main(void) {
+ int i, j;
+    for (j=0; j < 2; ++j) {
+        g_31 = -3;
+        for (i=0; i < 2; ++i)
+          g_76 = (g_31 ? g_31+1 : 0) ^ g_5;
+    }
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
Index: tree-vect-patterns.c
===================================================================
--- tree-vect-patterns.c        (revision 177646)
+++ tree-vect-patterns.c        (working copy)
@@ -897,7 +897,8 @@  vect_operation_fits_smaller_type (gimple stmt, tre
   else
     {
       first = true;
-      if (!widened_name_p (oprnd, stmt, &half_type, &def_stmt, false))
+      if (!widened_name_p (oprnd, stmt, &half_type, &def_stmt, false)
+          || !vinfo_for_stmt (def_stmt))
         return false;
     }