Index: ChangeLog
===================================================================
--- ChangeLog	(revision 178967)
+++ ChangeLog	(working copy)
@@ -1,3 +1,9 @@
+2011-09-19  Ira Rosen  <ira.rosen@linaro.org>
+
+	PR tree-optimization/50413
+	* tree-vect-data-refs.c (vect_analyze_data_refs): Fail to vectorize
+	a basic block if one of its data-refs can't be analyzed.
+
 2011-09-19  Paul Brook  <paul@codesourcery.com>
 
 	gcc/
Index: testsuite/ChangeLog
===================================================================
--- testsuite/ChangeLog	(revision 178967)
+++ testsuite/ChangeLog	(working copy)
@@ -1,3 +1,11 @@
+2011-09-19  Ira Rosen  <ira.rosen@linaro.org>
+
+	PR tree-optimization/50413
+	* g++.dg/vect/vect.exp: Run slp-pr* tests with
+	-fdump-tree-slp-details.  Run other tests with
+	-fdump-tree-vect-details.
+	* g++.dg/vect/slp-pr50413.cc: New.
+
 2011-09-18  Dominique d'Humieres  <dominiq@lps.ens.fr>
 	    Ira Rosen  <ira.rosen@linaro.org>
 
@@ -4,7 +12,7 @@
 	PR testsuite/50435
 	* gcc.dg/vect/bb-slp-25.c: Add an if to avoid loop vectorization.
 	Fix underscores around restrict.
- 
+
 2011-09-18  Ira Rosen  <ira.rosen@linaro.org>
 
 	PR tree-optimization/50414
Index: testsuite/g++.dg/vect/vect.exp
===================================================================
--- testsuite/g++.dg/vect/vect.exp	(revision 178967)
+++ testsuite/g++.dg/vect/vect.exp	(working copy)
@@ -40,9 +40,14 @@ global DEFAULT_VECTCFLAGS
 set DEFAULT_VECTCFLAGS ""
 
 # These flags are used for all targets.
-lappend DEFAULT_VECTCFLAGS "-O2" "-ftree-vectorize" "-fno-vect-cost-model" \
-  "-ftree-vectorizer-verbose=4" "-fdump-tree-vect-stats"
+lappend DEFAULT_VECTCFLAGS "-O2" "-ftree-vectorize" "-fno-vect-cost-model"
 
+set VECT_SLP_CFLAGS $DEFAULT_VECTCFLAGS
+
+lappend DEFAULT_VECTCFLAGS "-fdump-tree-vect-details"
+lappend VECT_SLP_CFLAGS "-fdump-tree-slp-details"
+
+
 # Skip these tests for targets that do not support generating vector
 # code.  Set additional target-dependent vector flags, which can be
 # overridden by using dg-options in individual tests.
@@ -54,8 +59,10 @@ if ![check_vect_support_and_set_flags] {
 dg-init
 
 # Main loop.
-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{c,cc,S} ]] \
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/pr*.{c,cc,S} ]] \
         "" $DEFAULT_VECTCFLAGS
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/slp-pr*.{c,cc,S} ]] \
+        "" $VECT_SLP_CFLAGS
 
 #### Tests with special options
 global SAVED_DEFAULT_VECTCFLAGS
Index: testsuite/g++.dg/vect/slp-pr50413.cc
===================================================================
--- testsuite/g++.dg/vect/slp-pr50413.cc	(revision 0)
+++ testsuite/g++.dg/vect/slp-pr50413.cc	(revision 0)
@@ -0,0 +1,185 @@
+/* { dg-require-effective-target vect_int } */
+
+typedef unsigned long long UInt64;
+
+typedef struct struct128
+{
+  UInt64 uint64_lower;
+  UInt64 uint64_upper;
+}
+STRUCT_128;
+
+typedef union uint128_bitmap
+{
+  STRUCT_128 uint128;
+  
+    struct
+    {
+      UInt64 b00 : 1;
+      UInt64 b01 : 1;
+      UInt64 b02 : 1;
+      UInt64 b03 : 1;
+      UInt64 b04 : 1;
+      UInt64 b05 : 1;
+      UInt64 b06 : 1;
+      UInt64 b07 : 1;
+      UInt64 b08 : 1;
+      UInt64 b09 : 1;
+      UInt64 b10 : 1;
+      UInt64 b11 : 1;
+      UInt64 b12 : 1;
+      UInt64 b13 : 1;
+      UInt64 b14 : 1;
+      UInt64 b15 : 1;
+      UInt64 b16 : 1;
+      UInt64 b17 : 1;
+      UInt64 b18 : 1;
+      UInt64 b19 : 1;
+      UInt64 b20 : 1;
+      UInt64 b21 : 1;
+      UInt64 b22 : 1;
+      UInt64 b23 : 1;
+      UInt64 b24 : 1;
+      UInt64 b25 : 1;
+      UInt64 b26 : 1;
+      UInt64 b27 : 1;
+      UInt64 b28 : 1;
+      UInt64 b29 : 1;
+      UInt64 b30 : 1;
+      UInt64 b31 : 1;
+      UInt64 b32 : 1;
+      UInt64 b33 : 1;
+      UInt64 b34 : 1;
+      UInt64 b35 : 1;
+      UInt64 b36 : 1;
+      UInt64 b37 : 1;
+      UInt64 b38 : 1;
+      UInt64 b39 : 1;
+      UInt64 b40 : 1;
+      UInt64 b41 : 1;
+      UInt64 b42 : 1;
+      UInt64 b43 : 1;
+      UInt64 b44 : 1;
+      UInt64 b45 : 1;
+      UInt64 b46 : 1;
+      UInt64 b47 : 1;
+      UInt64 b48 : 1;
+      UInt64 b49 : 1;
+      UInt64 b50 : 1;
+      UInt64 b51 : 1;
+      UInt64 b52 : 1;
+      UInt64 b53 : 1;
+      UInt64 b54 : 1;
+      UInt64 b55 : 1;
+      UInt64 b56 : 1;
+      UInt64 b57 : 1;
+      UInt64 b58 : 1;
+      UInt64 b59 : 1;
+      UInt64 b60 : 1;
+      UInt64 b61 : 1;
+      UInt64 b62 : 1;
+      UInt64 b63 : 1;
+      UInt64 b64 : 1;
+      UInt64 b65 : 1;
+      UInt64 b66 : 1;
+      UInt64 b67 : 1;
+      UInt64 b68 : 1;
+      UInt64 b69 : 1;
+      UInt64 b70 : 1;
+      UInt64 b71 : 1;
+      UInt64 b72 : 1;
+      UInt64 b73 : 1;
+      UInt64 b74 : 1;
+      UInt64 b75 : 1;
+      UInt64 b76 : 1;
+      UInt64 b77 : 1;
+      UInt64 b78 : 1;
+      UInt64 b79 : 1;
+      UInt64 b80 : 1;
+      UInt64 b81 : 1;
+      UInt64 b82 : 1;
+      UInt64 b83 : 1;
+      UInt64 b84 : 1;
+      UInt64 b85 : 1;
+      UInt64 b86 : 1;
+      UInt64 b87 : 1;
+      UInt64 b88 : 1;
+      UInt64 b89 : 1;
+      UInt64 b90 : 1;
+      UInt64 b91 : 1;
+      UInt64 b92 : 1;
+      UInt64 b93 : 1;
+      UInt64 b94 : 1;
+      UInt64 b95 : 1;
+      UInt64 b96 : 1;
+      UInt64 b97 : 1;
+      UInt64 b98 : 1;
+      UInt64 b99 : 1;
+      UInt64 b100 : 1;
+      UInt64 b101 : 1;
+      UInt64 b102 : 1;
+      UInt64 b103 : 1;
+      UInt64 b104 : 1;
+      UInt64 b105 : 1;
+      UInt64 b106 : 1;
+      UInt64 b107 : 1;
+      UInt64 b108 : 1;
+      UInt64 b109 : 1;
+      UInt64 b110 : 1;
+      UInt64 b111 : 1;
+      UInt64 b112 : 1;
+      UInt64 b113 : 1;
+      UInt64 b114 : 1;
+      UInt64 b115 : 1;
+      UInt64 b116 : 1;
+      UInt64 b117 : 1;
+      UInt64 b118 : 1;
+      UInt64 b119 : 1;
+      UInt64 b120 : 1;
+      UInt64 b121 : 1;
+      UInt64 b122 : 1;
+      UInt64 b123 : 1;
+      UInt64 b124 : 1;
+      UInt64 b125 : 1;
+      UInt64 b126 : 1;
+      UInt64 b127 : 1;
+    }
+    bitmap;
+}
+UInt128_BITMAP;
+
+UInt128_BITMAP V;
+
+template<typename CAST>
+unsigned char get_bit(CAST value, unsigned char pos)
+{
+    return ( value & (static_cast<CAST>(1) << pos) ) != 0;
+}
+
+void shift(unsigned char t)
+{
+  V.uint128.uint64_lower = (V.uint128.uint64_lower >> 1);
+  V.bitmap.b63 = V.bitmap.b64;
+  V.uint128.uint64_upper = (V.uint128.uint64_upper >> 1);
+  
+  V.bitmap.b96 = t;
+}
+
+int main()
+{
+   V.uint128.uint64_lower = 0;
+   V.uint128.uint64_upper = 0xd4004001;
+
+   UInt64 Kc = 0xDD1A1B8A8A5C2400;
+ 
+  for (int i = 0; i < 64; i++ )
+  {
+    shift( get_bit( Kc, i) );
+  }
+
+   return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 0 "slp" } } */
+/* { dg-final { cleanup-tree-dump "slp" } } */
+
Index: tree-vect-data-refs.c
===================================================================
--- tree-vect-data-refs.c	(revision 178967)
+++ tree-vect-data-refs.c	(working copy)
@@ -2595,14 +2595,7 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo,
               print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
             }
 
-          if (bb_vinfo)
-            {
-              /* Mark the statement as not vectorizable.  */
-              STMT_VINFO_VECTORIZABLE (stmt_info) = false;
-              continue;
-            }
-          else
-            return false;
+          return false;
         }
 
       if (TREE_CODE (DR_BASE_ADDRESS (dr)) == INTEGER_CST)
@@ -2610,14 +2603,7 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo,
           if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))
             fprintf (vect_dump, "not vectorized: base addr of dr is a "
                      "constant");
-          if (bb_vinfo)
-            {
-              /* Mark the statement as not vectorizable.  */
-              STMT_VINFO_VECTORIZABLE (stmt_info) = false;
-              continue;
-            }
-          else
-            return false;
+          return false;
         }
 
       if (TREE_THIS_VOLATILE (DR_REF (dr)))
