diff mbox

Fix ICE during RTL expansion at -O1

Message ID 13643527.5fuA5OUxPv@polaris
State New
Headers show

Commit Message

Eric Botcazou March 21, 2013, 4:24 p.m. UTC
Hi,

this fixes an ICE on the mainline at -O1:

eric@polaris:~/gnat/bugs/M129-026> ~/install/gcc/bin/gcc -S p.adb -O
+===========================GNAT BUG DETECTED==============================+
| 4.9.0 20130320 (experimental) [trunk revision 196816] (x86_64-suse-linux) 
GCC error:|
| in expand_assignment, at expr.c:4761                                     |
| Error detected around p.ads:11:9      

  MEM[(struct p__rec &)&ret].d = 0;
  MEM[(struct p__rec &)&ret].b1 = 0;
  _26 = MEM[(struct p__rec &)&ret].d;
  p0.8_27 = (integer) _26;
  _28 = (sizetype) p0.8_27;
  _29 = _28 * 8;
  _30 = _29 + _29;
  _31 = _30 + 8;
  _32 = _31 /[ex] 8;
  MEM[(struct p__rec &)&ret].b2{off: _32 * 8} = 1;

The ICE occurs because ret is put into a register instead of memory (it has
an integral mode) and you cannot have a variable offset within an object in
a register.

But, if you look at the above GIMPLE from .optimized, you'll see that the
offset is actually fixed and that the GIMPLE optimizers weren't powerful
enough to see it.  Ironically enough, the RTL optimizers would have been!

So the attached patch adds a clone of nonoverlapping_component_refs_p from
alias.c to tree-ssa-alias.c to disambiguate the memory accesses.  It also
contains a small tweak to both functions to cater to a LTO-specific quirk.

With it, a bunch of testcases of the vectorization testsuite are optimized
so the patch also contains counter-measures for them.

Tested on x86_64-suse-linux, OK for the mainline?


2013-03-21  Eric Botcazou  <ebotcazou@adacore.com>

	* alias.c (nonoverlapping_component_refs_p): Protect again LTO quirk.
	* tree-ssa-alias.c (nonoverlapping_component_refs_of_decl_p): New.
	(decl_refs_may_alias_p): Add REF1 and REF2 parameters.
	Use it to disambiguate component references.
	(refs_may_alias_p_1): Adjust call to decl_refs_may_alias_p.


2013-03-21  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/discr41.ad[sb]: New test.
	* gcc.dg/vect/slp-24-big-array.c: Beef up anti-vectorization trick.
	* gcc.dg/vect/slp-24.c: Likewise.
	* gcc.dg/vect/vect-strided-a-mult.c: Likewise.
	* gcc.dg/vect/vect-strided-a-u16-i2.c: Likewise.
	* gcc.dg/vect/vect-strided-a-u16-i4.c: Likewise.
	* gcc.dg/vect/vect-strided-a-u16-mult.c: Likewise.
	* gcc.dg/vect/vect-strided-a-u8-i2-gap.c: Likewise.
	* gcc.dg/vect/vect-strided-a-u8-i8-gap2-big-array.c: Likewise.
	* gcc.dg/vect/vect-strided-a-u8-i8-gap2.c: Likewise.
	* gcc.dg/vect/vect-strided-a-u8-i8-gap7-big-array.c: Likewise.
	* gcc.dg/vect/vect-strided-a-u8-i8-gap7.c: Likewise.
	* gcc.dg/vect/vect-strided-mult-char-ls.c: Likewise.
	* gcc.dg/vect/vect-strided-mult.c: Likewise.
	* gcc.dg/vect/vect-strided-same-dr.c: Likewise.
	* gcc.dg/vect/vect-strided-u16-i2.c: Likewise.
	* gcc.dg/vect/vect-strided-u16-i4.c: Likewise.
	* gcc.dg/vect/vect-strided-u32-i4.c: Likewise.
	* gcc.dg/vect/vect-strided-u32-i8.c: Likewise.
	* gcc.dg/vect/vect-strided-u8-i2-gap.c: Likewise.
	* gcc.dg/vect/vect-strided-u8-i2.c: Likewise.
	* gcc.dg/vect/vect-strided-u8-i8-gap2-big-array.c: Likewise.
	* gcc.dg/vect/vect-strided-u8-i8-gap2.c: Likewise.
	* gcc.dg/vect/vect-strided-u8-i8-gap4-big-array.c: Likewise.
	* gcc.dg/vect/vect-strided-u8-i8-gap4-unknown.c: Likewise.
	* gcc.dg/vect/vect-strided-u8-i8-gap4.c: Likewise.
	* gcc.dg/vect/vect-strided-u8-i8-gap7-big-array.c: Likewise.
	* gcc.dg/vect/vect-strided-u8-i8-gap7.c: Likewise.
	* gcc.dg/vect/vect-strided-u8-i8.c: Likewise.

Comments

Richard Biener March 22, 2013, 9:42 a.m. UTC | #1
On Thu, Mar 21, 2013 at 5:24 PM, Eric Botcazou <ebotcazou@adacore.com> wrote:
> Hi,
>
> this fixes an ICE on the mainline at -O1:
>
> eric@polaris:~/gnat/bugs/M129-026> ~/install/gcc/bin/gcc -S p.adb -O
> +===========================GNAT BUG DETECTED==============================+
> | 4.9.0 20130320 (experimental) [trunk revision 196816] (x86_64-suse-linux)
> GCC error:|
> | in expand_assignment, at expr.c:4761                                     |
> | Error detected around p.ads:11:9
>
>   MEM[(struct p__rec &)&ret].d = 0;
>   MEM[(struct p__rec &)&ret].b1 = 0;
>   _26 = MEM[(struct p__rec &)&ret].d;
>   p0.8_27 = (integer) _26;
>   _28 = (sizetype) p0.8_27;
>   _29 = _28 * 8;
>   _30 = _29 + _29;
>   _31 = _30 + 8;
>   _32 = _31 /[ex] 8;
>   MEM[(struct p__rec &)&ret].b2{off: _32 * 8} = 1;
>
> The ICE occurs because ret is put into a register instead of memory (it has
> an integral mode) and you cannot have a variable offset within an object in
> a register.
>
> But, if you look at the above GIMPLE from .optimized, you'll see that the
> offset is actually fixed and that the GIMPLE optimizers weren't powerful
> enough to see it.  Ironically enough, the RTL optimizers would have been!
>
> So the attached patch adds a clone of nonoverlapping_component_refs_p from
> alias.c to tree-ssa-alias.c to disambiguate the memory accesses.  It also
> contains a small tweak to both functions to cater to a LTO-specific quirk.
>
> With it, a bunch of testcases of the vectorization testsuite are optimized
> so the patch also contains counter-measures for them.
>
> Tested on x86_64-suse-linux, OK for the mainline?

This is a quadratic algorithm and as such not ok.  We already have
aliasing_component_refs_p in tree-ssa-alias.c which is supposed to be
the non-quadratic replacement.  It's not used via decl_refs_may_alias_p,
so that may be the thing to fix.

nonoverlapping_component_refs_of_decl_p on RTL should go - in fact
we do call the tree oracle from all its callers so we only ever do redundant
work (after your proposed patch even more so).

(I recently tried to cache the ao_ref in mem-attrs but failed because of
weird gengtype issues ... we could avoid the repeated get_ref_base_and_extent
calls done via ao_ref_from_mem that way).

Richard.

>
> 2013-03-21  Eric Botcazou  <ebotcazou@adacore.com>
>
>         * alias.c (nonoverlapping_component_refs_p): Protect again LTO quirk.
>         * tree-ssa-alias.c (nonoverlapping_component_refs_of_decl_p): New.
>         (decl_refs_may_alias_p): Add REF1 and REF2 parameters.
>         Use it to disambiguate component references.
>         (refs_may_alias_p_1): Adjust call to decl_refs_may_alias_p.
>
>
> 2013-03-21  Eric Botcazou  <ebotcazou@adacore.com>
>
>         * gnat.dg/discr41.ad[sb]: New test.
>         * gcc.dg/vect/slp-24-big-array.c: Beef up anti-vectorization trick.
>         * gcc.dg/vect/slp-24.c: Likewise.
>         * gcc.dg/vect/vect-strided-a-mult.c: Likewise.
>         * gcc.dg/vect/vect-strided-a-u16-i2.c: Likewise.
>         * gcc.dg/vect/vect-strided-a-u16-i4.c: Likewise.
>         * gcc.dg/vect/vect-strided-a-u16-mult.c: Likewise.
>         * gcc.dg/vect/vect-strided-a-u8-i2-gap.c: Likewise.
>         * gcc.dg/vect/vect-strided-a-u8-i8-gap2-big-array.c: Likewise.
>         * gcc.dg/vect/vect-strided-a-u8-i8-gap2.c: Likewise.
>         * gcc.dg/vect/vect-strided-a-u8-i8-gap7-big-array.c: Likewise.
>         * gcc.dg/vect/vect-strided-a-u8-i8-gap7.c: Likewise.
>         * gcc.dg/vect/vect-strided-mult-char-ls.c: Likewise.
>         * gcc.dg/vect/vect-strided-mult.c: Likewise.
>         * gcc.dg/vect/vect-strided-same-dr.c: Likewise.
>         * gcc.dg/vect/vect-strided-u16-i2.c: Likewise.
>         * gcc.dg/vect/vect-strided-u16-i4.c: Likewise.
>         * gcc.dg/vect/vect-strided-u32-i4.c: Likewise.
>         * gcc.dg/vect/vect-strided-u32-i8.c: Likewise.
>         * gcc.dg/vect/vect-strided-u8-i2-gap.c: Likewise.
>         * gcc.dg/vect/vect-strided-u8-i2.c: Likewise.
>         * gcc.dg/vect/vect-strided-u8-i8-gap2-big-array.c: Likewise.
>         * gcc.dg/vect/vect-strided-u8-i8-gap2.c: Likewise.
>         * gcc.dg/vect/vect-strided-u8-i8-gap4-big-array.c: Likewise.
>         * gcc.dg/vect/vect-strided-u8-i8-gap4-unknown.c: Likewise.
>         * gcc.dg/vect/vect-strided-u8-i8-gap4.c: Likewise.
>         * gcc.dg/vect/vect-strided-u8-i8-gap7-big-array.c: Likewise.
>         * gcc.dg/vect/vect-strided-u8-i8-gap7.c: Likewise.
>         * gcc.dg/vect/vect-strided-u8-i8.c: Likewise.
>
>
> --
> Eric Botcazou
diff mbox

Patch

Index: alias.c
===================================================================
--- alias.c	(revision 196816)
+++ alias.c	(working copy)
@@ -2239,8 +2239,11 @@  nonoverlapping_component_refs_p (const_r
 
     found:
       /* If we're left with accessing different fields of a structure, then no
-	 possible overlap, unless they are both bitfields.  */
-      if (TREE_CODE (typex) == RECORD_TYPE && fieldx != fieldy)
+	 possible overlap, unless they are both bitfields.
+	 ??? Pointer inequality is too fragile in the LTO compiler.  */
+      if (TREE_CODE (typex) == RECORD_TYPE
+	  && fieldx != fieldy
+	  && DECL_NAME (fieldx) != DECL_NAME (fieldy))
 	return !(DECL_BIT_FIELD (fieldx) && DECL_BIT_FIELD (fieldy));
 
       /* The comparison on the current field failed.  If we're accessing
Index: tree-ssa-alias.c
===================================================================
--- tree-ssa-alias.c	(revision 196816)
+++ tree-ssa-alias.c	(working copy)
@@ -700,14 +700,78 @@  aliasing_component_refs_p (tree ref1,
   return false;
 }
 
+/* Return true if we can determine that component references X and Y, that are
+   within a common variable, cannot overlap.  This is a generalized version of
+   nonoverlapping_component_refs_p under the common variable assumption.  */
+
+static bool
+nonoverlapping_component_refs_of_decl_p (const_tree x, const_tree y)
+{
+  const_tree fieldx, fieldy, typex, typey, orig_y = y;
+
+  do
+    {
+      /* The comparison has to be done at a common type, since we don't
+	 know how the inheritance hierarchy works.  */
+      orig_y = y;
+      do
+	{
+	  if (TREE_CODE (x) == COMPONENT_REF)
+	    {
+	      fieldx = TREE_OPERAND (x, 1);
+	      typex = TYPE_MAIN_VARIANT (DECL_FIELD_CONTEXT (fieldx));
+
+	      y = orig_y;
+	      do
+		{
+		  if (TREE_CODE (y) == COMPONENT_REF)
+		    {
+		      fieldy = TREE_OPERAND (y, 1);
+		      typey = TYPE_MAIN_VARIANT (DECL_FIELD_CONTEXT (fieldy));
+
+		      if (typex == typey)
+			goto found;
+		    }
+	          y = TREE_OPERAND (y, 0);
+	        }
+	      while (y && handled_component_p (y));
+	    }
+	  x = TREE_OPERAND (x, 0);
+	}
+      while (x && handled_component_p (x));
+      /* Never found a common type.  */
+      return false;
+
+    found:
+      /* If we're left with accessing different fields of a structure,
+	 then no overlap.
+	 ??? Pointer inequality is too fragile in the LTO compiler.  */
+      if (TREE_CODE (typex) == RECORD_TYPE
+	  && fieldx != fieldy
+	  && DECL_NAME (fieldx) != DECL_NAME (fieldy))
+	return true;
+
+      /* The comparison on the current field failed.  If we're accessing
+	 a very nested structure, look at the next outer level.  */
+      x = TREE_OPERAND (x, 0);
+      y = TREE_OPERAND (y, 0);
+    }
+  while (x && y
+	 && handled_component_p (x)
+	 && handled_component_p (y));
+
+  return false;
+}
+
 /* Return true if two memory references based on the variables BASE1
    and BASE2 constrained to [OFFSET1, OFFSET1 + MAX_SIZE1) and
-   [OFFSET2, OFFSET2 + MAX_SIZE2) may alias.  */
+   [OFFSET2, OFFSET2 + MAX_SIZE2) may alias.  REF1 and REF2
+   if non-NULL are the complete memory reference trees.  */
 
 static bool
-decl_refs_may_alias_p (tree base1,
+decl_refs_may_alias_p (tree ref1, tree base1,
 		       HOST_WIDE_INT offset1, HOST_WIDE_INT max_size1,
-		       tree base2,
+		       tree ref2, tree base2,
 		       HOST_WIDE_INT offset2, HOST_WIDE_INT max_size2)
 {
   gcc_checking_assert (DECL_P (base1) && DECL_P (base2));
@@ -718,7 +782,17 @@  decl_refs_may_alias_p (tree base1,
 
   /* If both references are based on the same variable, they cannot alias if
      the accesses do not overlap.  */
-  return ranges_overlap_p (offset1, max_size1, offset2, max_size2);
+  if (!ranges_overlap_p (offset1, max_size1, offset2, max_size2))
+    return false;
+
+  /* For components with variable position, the above test isn't sufficient,
+     so we disambiguate component references manually.  */
+  if (ref1 && ref2
+      && handled_component_p (ref1) && handled_component_p (ref2)
+      && nonoverlapping_component_refs_of_decl_p (ref1, ref2))
+    return false;
+
+  return true;     
 }
 
 /* Return true if an indirect reference based on *PTR1 constrained
@@ -1067,8 +1141,8 @@  refs_may_alias_p_1 (ao_ref *ref1, ao_ref
   var1_p = DECL_P (base1);
   var2_p = DECL_P (base2);
   if (var1_p && var2_p)
-    return decl_refs_may_alias_p (base1, offset1, max_size1,
-				  base2, offset2, max_size2);
+    return decl_refs_may_alias_p (ref1->ref, base1, offset1, max_size1,
+				  ref2->ref, base2, offset2, max_size2);
 
   ind1_p = (TREE_CODE (base1) == MEM_REF
 	    || TREE_CODE (base1) == TARGET_MEM_REF);
Index: testsuite/gcc.dg/vect/vect-strided-a-u16-mult.c
===================================================================
--- testsuite/gcc.dg/vect/vect-strided-a-u16-mult.c	(revision 196816)
+++ testsuite/gcc.dg/vect/vect-strided-a-u16-mult.c	(working copy)
@@ -10,6 +10,8 @@  typedef struct {
    unsigned short b;
 } s;
 
+volatile int y = 0;
+
 __attribute__ ((noinline)) int
 main1 ()
 {
@@ -26,8 +28,8 @@  main1 ()
       arr[i].a = i;
       arr[i].b = i * 2;
       iarr[i] = i * 3;
-      if (arr[i].a == 178)
-         abort();
+      if (y) /* Avoid vectorization.  */
+        abort ();
     }
 
   for (i = 0; i < N; i++)
Index: testsuite/gcc.dg/vect/vect-strided-u32-i4.c
===================================================================
--- testsuite/gcc.dg/vect/vect-strided-u32-i4.c	(revision 196816)
+++ testsuite/gcc.dg/vect/vect-strided-u32-i4.c	(working copy)
@@ -12,6 +12,8 @@  typedef struct {
    int d;
 } s;
 
+volatile int y = 0;
+
 __attribute__ ((noinline)) int
 main1 (s *arr)
 {
@@ -54,8 +56,8 @@  int main (void)
       arr[i].b = i * 2;
       arr[i].c = 17;
       arr[i].d = i+34;
-      if (arr[i].a == 178)
-         abort(); 
+      if (y) /* Avoid vectorization.  */
+        abort ();
     } 
 
   main1 (arr);
Index: testsuite/gcc.dg/vect/vect-strided-u8-i8-gap4-unknown.c
===================================================================
--- testsuite/gcc.dg/vect/vect-strided-u8-i8-gap4-unknown.c	(revision 196816)
+++ testsuite/gcc.dg/vect/vect-strided-u8-i8-gap4-unknown.c	(working copy)
@@ -17,6 +17,8 @@  typedef struct {
    unsigned char h;
 } s;
 
+volatile int y = 0;
+
 __attribute__ ((noinline)) int
 main1 (s *arr, int n)
 {
@@ -102,8 +104,8 @@  int main (void)
       arr[i].f = 16;
       arr[i].g = 3;
       arr[i].h = 56;
-      if (arr[i].a == 178)
-         abort(); 
+      if (y) /* Avoid vectorization.  */
+        abort ();
     } 
 
   main1 (arr, N-2);
Index: testsuite/gcc.dg/vect/vect-strided-u8-i2-gap.c
===================================================================
--- testsuite/gcc.dg/vect/vect-strided-u8-i2-gap.c	(revision 196816)
+++ testsuite/gcc.dg/vect/vect-strided-u8-i2-gap.c	(working copy)
@@ -10,6 +10,8 @@  typedef struct {
    unsigned char b;
 } s;
 
+volatile int y = 0;
+
 __attribute__ ((noinline)) int
 main1 (s *arr)
 {
@@ -62,8 +64,8 @@  int main (void)
     { 
       arr[i].a = i;
       arr[i].b = i * 2;
-      if (arr[i].a == 178)
-         abort(); 
+      if (y) /* Avoid vectorization.  */
+        abort ();
     } 
 
   main1 (arr);
Index: testsuite/gcc.dg/vect/vect-strided-u8-i8-gap4-big-array.c
===================================================================
--- testsuite/gcc.dg/vect/vect-strided-u8-i8-gap4-big-array.c	(revision 196816)
+++ testsuite/gcc.dg/vect/vect-strided-u8-i8-gap4-big-array.c	(working copy)
@@ -18,6 +18,8 @@  typedef struct {
 
 s check_res[N];
 
+volatile int y = 0;
+
 __attribute__ ((noinline)) int
 main1 (s *arr)
 {
@@ -103,8 +105,8 @@  int main (void)
       check_res[i].h = arr[i].c;
       check_res[i].g = arr[i].b + arr[i].c;
 
-      if (arr[i].a == 178)
-         abort ();
+      if (y) /* Avoid vectorization.  */
+        abort ();
     }
   main1 (arr);
 
Index: testsuite/gcc.dg/vect/slp-24-big-array.c
===================================================================
--- testsuite/gcc.dg/vect/slp-24-big-array.c	(revision 196816)
+++ testsuite/gcc.dg/vect/slp-24-big-array.c	(working copy)
@@ -84,8 +84,8 @@  int main (void)
       arr[i].b = i * 2 + 10;
       arr[i].c = 17;
       arr[i].d = i+34;
-      if (arr[i].a == 178)
-         abort ();
+      if (y) /* Avoid vectorization.  */
+        abort ();
     }
   check_vect ();
 
Index: testsuite/gcc.dg/vect/vect-strided-u8-i8.c
===================================================================
--- testsuite/gcc.dg/vect/vect-strided-u8-i8.c	(revision 196816)
+++ testsuite/gcc.dg/vect/vect-strided-u8-i8.c	(working copy)
@@ -16,6 +16,8 @@  typedef struct {
    unsigned char h;
 } s;
 
+volatile int y = 0;
+
 __attribute__ ((noinline)) int
 main1 (s *arr)
 {
@@ -76,8 +78,8 @@  int main (void)
       arr[i].f = i + 5;
       arr[i].g = i + 3;
       arr[i].h = 67;
-      if (arr[i].a == 178)
-         abort(); 
+      if (y) /* Avoid vectorization.  */
+        abort ();
     } 
 
   main1 (arr);
Index: testsuite/gcc.dg/vect/vect-strided-u16-i2.c
===================================================================
--- testsuite/gcc.dg/vect/vect-strided-u16-i2.c	(revision 196816)
+++ testsuite/gcc.dg/vect/vect-strided-u16-i2.c	(working copy)
@@ -10,6 +10,8 @@  typedef struct {
    unsigned short b;
 } s;
 
+volatile int y = 0;
+
 __attribute__ ((noinline)) int
 main1 (s *arr)
 {
@@ -46,8 +48,8 @@  int main (void)
     { 
       arr[i].a = i;
       arr[i].b = i * 2;
-      if (arr[i].a == 178)
-         abort(); 
+      if (y) /* Avoid vectorization.  */
+        abort ();
     } 
 
   main1 (arr);
Index: testsuite/gcc.dg/vect/vect-strided-a-mult.c
===================================================================
--- testsuite/gcc.dg/vect/vect-strided-a-mult.c	(revision 196816)
+++ testsuite/gcc.dg/vect/vect-strided-a-mult.c	(working copy)
@@ -15,6 +15,8 @@  typedef struct {
    unsigned int b;
 } ii;
 
+volatile int y = 0;
+
 __attribute__ ((noinline)) int
 main1 ()
 {
@@ -32,8 +34,8 @@  main1 ()
       arr[i].b = i * 2;
       iarr[i].a = i;
       iarr[i].b = i * 3;
-      if (arr[i].a == 178)
-         abort();
+      if (y) /* Avoid vectorization.  */
+        abort ();
     }
 
   for (i = 0; i < N; i++)
Index: testsuite/gcc.dg/vect/vect-strided-u8-i8-gap7-big-array.c
===================================================================
--- testsuite/gcc.dg/vect/vect-strided-u8-i8-gap7-big-array.c	(revision 196816)
+++ testsuite/gcc.dg/vect/vect-strided-u8-i8-gap7-big-array.c	(working copy)
@@ -18,6 +18,8 @@  typedef struct {
 
 s check_res[N];
 
+volatile int y = 0;
+
 __attribute__ ((noinline)) int
 main1 (s *arr)
 {
@@ -91,8 +93,8 @@  int main (void)
       check_res[i].h = arr[i].d;
       check_res[i].g = u + t;
 
-      if (arr[i].a == 178)
-         abort ();
+      if (y) /* Avoid vectorization.  */
+        abort ();
     }
 
   main1 (arr);
Index: testsuite/gcc.dg/vect/vect-strided-u8-i8-gap2.c
===================================================================
--- testsuite/gcc.dg/vect/vect-strided-u8-i8-gap2.c	(revision 196816)
+++ testsuite/gcc.dg/vect/vect-strided-u8-i8-gap2.c	(working copy)
@@ -16,6 +16,8 @@  typedef struct {
    unsigned char h;
 } s;
 
+volatile int y = 0;
+
 __attribute__ ((noinline)) int
 main1 (s *arr)
 {
@@ -69,8 +71,8 @@  int main (void)
       arr[i].f = i * 2 + 2;
       arr[i].g = i - 3;
       arr[i].h = 56;
-      if (arr[i].a == 178)
-         abort(); 
+      if (y) /* Avoid vectorization.  */
+        abort ();
     } 
 
   main1 (arr);
Index: testsuite/gcc.dg/vect/vect-strided-u16-i4.c
===================================================================
--- testsuite/gcc.dg/vect/vect-strided-u16-i4.c	(revision 196816)
+++ testsuite/gcc.dg/vect/vect-strided-u16-i4.c	(working copy)
@@ -12,6 +12,8 @@  typedef struct {
    unsigned short d;
 } s;
 
+volatile int y = 0;
+
 __attribute__ ((noinline)) int
 main1 (s *arr)
 {
@@ -59,8 +61,8 @@  int main (void)
       arr[i].b = i * 2;
       arr[i].c = 17;
       arr[i].d = i+34;
-      if (arr[i].a == 178)
-         abort(); 
+      if (y) /* Avoid vectorization.  */
+        abort ();
     } 
 
   main1 (arr);
Index: testsuite/gcc.dg/vect/vect-strided-u32-i8.c
===================================================================
--- testsuite/gcc.dg/vect/vect-strided-u32-i8.c	(revision 196816)
+++ testsuite/gcc.dg/vect/vect-strided-u32-i8.c	(working copy)
@@ -16,6 +16,8 @@  typedef struct {
    int h;
 } s;
 
+volatile int y = 0;
+
 __attribute__ ((noinline)) int
 main1 (s *arr)
 {
@@ -68,8 +70,8 @@  int main (void)
       arr[i].f = i * 5;
       arr[i].g = i - 3;
       arr[i].h = 56;
-      if (arr[i].a == 178)
-         abort(); 
+      if (y) /* Avoid vectorization.  */
+        abort ();
     } 
 
   main1 (arr);
Index: testsuite/gcc.dg/vect/vect-strided-u8-i8-gap2-big-array.c
===================================================================
--- testsuite/gcc.dg/vect/vect-strided-u8-i8-gap2-big-array.c	(revision 196816)
+++ testsuite/gcc.dg/vect/vect-strided-u8-i8-gap2-big-array.c	(working copy)
@@ -18,6 +18,8 @@  typedef struct {
 
 s check_res[N];
 
+volatile int y = 0;
+
 __attribute__ ((noinline)) int
 main1 (s *arr)
 {
@@ -80,8 +82,9 @@  int main (void)
       check_res[i].e = arr[i].f - arr[i].b;
       check_res[i].h = arr[i].f;
       check_res[i].g = arr[i].f - arr[i].b;
-      if (arr[i].a == 178)
-         abort ();
+
+      if (y) /* Avoid vectorization.  */
+        abort ();
     }
 
   main1 (arr);
Index: testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap2.c
===================================================================
--- testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap2.c	(revision 196816)
+++ testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap2.c	(working copy)
@@ -16,6 +16,8 @@  typedef struct {
    unsigned char h;
 } s;
 
+volatile int y = 0;
+
 __attribute__ ((noinline)) int
 main1 ()
 {
@@ -34,8 +36,8 @@  main1 ()
       arr[i].f = i * 2 + 2;
       arr[i].g = i - 3;
       arr[i].h = 56;
-      if (arr[i].a == 178)
-         abort();
+      if (y) /* Avoid vectorization.  */
+        abort ();
     }
 
   for (i = 0; i < N; i++)
Index: testsuite/gcc.dg/vect/vect-strided-u8-i8-gap4.c
===================================================================
--- testsuite/gcc.dg/vect/vect-strided-u8-i8-gap4.c	(revision 196816)
+++ testsuite/gcc.dg/vect/vect-strided-u8-i8-gap4.c	(working copy)
@@ -16,6 +16,8 @@  typedef struct {
    unsigned char h;
 } s;
 
+volatile int y = 0;
+
 __attribute__ ((noinline)) int
 main1 (s *arr)
 {
@@ -89,8 +91,8 @@  int main (void)
       arr[i].f = i * 5;
       arr[i].g = i - 3;
       arr[i].h = 56;
-      if (arr[i].a == 178)
-         abort(); 
+      if (y) /* Avoid vectorization.  */
+        abort ();
     } 
 
   main1 (arr);
Index: testsuite/gcc.dg/vect/slp-24.c
===================================================================
--- testsuite/gcc.dg/vect/slp-24.c	(revision 196816)
+++ testsuite/gcc.dg/vect/slp-24.c	(working copy)
@@ -16,6 +16,8 @@  typedef struct {
 unsigned char ub[N*2] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
 unsigned char uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
 
+volatile int y = 0;
+
 void
 main1 (unsigned char x, unsigned char max_result, unsigned char min_result, s *arr)
 {
@@ -67,8 +69,8 @@  int main (void)
       arr[i].b = i * 2 + 10;
       arr[i].c = 17;
       arr[i].d = i+34;
-      if (arr[i].a == 178)
-         abort();
+      if (y) /* Avoid vectorization.  */
+        abort ();
     }
   check_vect ();
   
Index: testsuite/gcc.dg/vect/vect-strided-a-u16-i2.c
===================================================================
--- testsuite/gcc.dg/vect/vect-strided-a-u16-i2.c	(revision 196816)
+++ testsuite/gcc.dg/vect/vect-strided-a-u16-i2.c	(working copy)
@@ -10,6 +10,8 @@  typedef struct {
    unsigned short b;
 } s;
 
+volatile int y = 0;
+
 __attribute__ ((noinline)) int
 main1 ()
 {
@@ -22,8 +24,8 @@  main1 ()
     {
       arr[i].a = i;
       arr[i].b = i * 2;
-      if (arr[i].a == 178)
-         abort();
+      if (y) /* Avoid vectorization.  */
+        abort ();
     }
 
   for (i = 0; i < N; i++)
Index: testsuite/gcc.dg/vect/vect-strided-u8-i8-gap7.c
===================================================================
--- testsuite/gcc.dg/vect/vect-strided-u8-i8-gap7.c	(revision 196816)
+++ testsuite/gcc.dg/vect/vect-strided-u8-i8-gap7.c	(working copy)
@@ -16,6 +16,8 @@  typedef struct {
    unsigned char h;
 } s;
 
+volatile int y = 0;
+
 __attribute__ ((noinline)) int
 main1 (s *arr)
 {
@@ -74,8 +76,8 @@  int main (void)
       arr[i].f = i * 5;
       arr[i].g = i - 3;
       arr[i].h = 67;
-      if (arr[i].a == 178)
-         abort(); 
+      if (y) /* Avoid vectorization.  */
+        abort ();
     } 
 
   main1 (arr);
Index: testsuite/gcc.dg/vect/vect-strided-a-u16-i4.c
===================================================================
--- testsuite/gcc.dg/vect/vect-strided-a-u16-i4.c	(revision 196816)
+++ testsuite/gcc.dg/vect/vect-strided-a-u16-i4.c	(working copy)
@@ -12,6 +12,8 @@  typedef struct {
    unsigned short d;
 } s;
 
+volatile int y = 0;
+
 __attribute__ ((noinline)) int
 main1 ()
 {
@@ -27,8 +29,8 @@  main1 ()
       arr[i].b = i * 2;
       arr[i].c = 17;
       arr[i].d = i+34;
-      if (arr[i].a == 178)
-         abort();
+      if (y) /* Avoid vectorization.  */
+        abort ();
     }
 
   for (i = 0; i < N; i++)
Index: testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap7.c
===================================================================
--- testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap7.c	(revision 196816)
+++ testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap7.c	(working copy)
@@ -16,6 +16,8 @@  typedef struct {
    unsigned char h;
 } s;
 
+volatile int y = 0;
+
 __attribute__ ((noinline)) int
 main1 ()
 {
@@ -35,8 +37,8 @@  main1 ()
       arr[i].f = i * 5;
       arr[i].g = i - 3;
       arr[i].h = 67;
-      if (arr[i].a == 178)
-         abort();
+      if (y) /* Avoid vectorization.  */
+        abort ();
     }
 
   for (i = 0; i < N; i++)
Index: testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap7-big-array.c
===================================================================
--- testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap7-big-array.c	(revision 196816)
+++ testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap7-big-array.c	(working copy)
@@ -16,6 +16,8 @@  typedef struct {
    unsigned char h;
 } s;
 
+volatile int y = 0;
+
 __attribute__ ((noinline)) int
 main1 ()
 {
@@ -50,8 +52,8 @@  main1 ()
       check_res[i].h = arr[i].d;
       check_res[i].g = u + t;
 
-      if (arr[i].a == 178)
-         abort ();
+      if (y) /* Avoid vectorization.  */
+        abort ();
     }
 
   for (i = 0; i < N; i++)
Index: testsuite/gcc.dg/vect/vect-strided-mult.c
===================================================================
--- testsuite/gcc.dg/vect/vect-strided-mult.c	(revision 196816)
+++ testsuite/gcc.dg/vect/vect-strided-mult.c	(working copy)
@@ -15,6 +15,8 @@  typedef struct {
    unsigned int b;
 } ii;
 
+volatile int y = 0;
+
 __attribute__ ((noinline)) int
 main1 (s *arr, ii *iarr)
 {
@@ -62,8 +64,8 @@  int main (void)
       arr[i].b = i * 2;
       iarr[i].a = i;
       iarr[i].b = i * 3;
-      if (arr[i].a == 178)
-         abort();
+      if (y) /* Avoid vectorization.  */
+        abort ();
     }
 
   main1 (arr, iarr); 
Index: testsuite/gcc.dg/vect/vect-strided-u8-i2.c
===================================================================
--- testsuite/gcc.dg/vect/vect-strided-u8-i2.c	(revision 196816)
+++ testsuite/gcc.dg/vect/vect-strided-u8-i2.c	(working copy)
@@ -10,6 +10,8 @@  typedef struct {
    unsigned char b;
 } s;
 
+volatile int y = 0;
+
 __attribute__ ((noinline)) int
 main1 (s *arr)
 {
@@ -45,8 +47,8 @@  int main (void)
     { 
       arr[i].a = i;
       arr[i].b = i * 2;
-      if (arr[i].a == 178)
-         abort(); 
+      if (y) /* Avoid vectorization.  */
+        abort ();
     } 
 
   main1 (arr);
Index: testsuite/gcc.dg/vect/vect-strided-a-u8-i2-gap.c
===================================================================
--- testsuite/gcc.dg/vect/vect-strided-a-u8-i2-gap.c	(revision 196816)
+++ testsuite/gcc.dg/vect/vect-strided-a-u8-i2-gap.c	(working copy)
@@ -10,6 +10,8 @@  typedef struct {
    unsigned char b;
 } s;
 
+volatile int y = 0;
+
 __attribute__ ((noinline)) int
 main1 ()
 {
@@ -22,8 +24,8 @@  main1 ()
     {
       arr[i].a = i;
       arr[i].b = i * 2;
-      if (arr[i].a == 178)
-         abort();
+      if (y) /* Avoid vectorization.  */
+        abort ();
     }
 
   for (i = 0; i < N; i++)
Index: testsuite/gcc.dg/vect/vect-strided-same-dr.c
===================================================================
--- testsuite/gcc.dg/vect/vect-strided-same-dr.c	(revision 196816)
+++ testsuite/gcc.dg/vect/vect-strided-same-dr.c	(working copy)
@@ -12,6 +12,8 @@  typedef struct {
 
 s buffer1[N], buffer2[N];
 
+volatile int y = 0;
+
 __attribute__ ((noinline)) int
 main1 (s * __restrict__  pIn, s* __restrict__ pOut)
 {
@@ -61,8 +63,8 @@  int main (void)
       buffer1[i].b = i + 8;
       buffer2[i].a = i * 3;
       buffer2[i].b = i * 2;
-      if (buffer1[i].a == 500)
-         abort();
+      if (y) /* Avoid vectorization.  */
+        abort ();
     }
 
   check_vect ();
Index: testsuite/gcc.dg/vect/vect-strided-mult-char-ls.c
===================================================================
--- testsuite/gcc.dg/vect/vect-strided-mult-char-ls.c	(revision 196816)
+++ testsuite/gcc.dg/vect/vect-strided-mult-char-ls.c	(working copy)
@@ -15,6 +15,8 @@  typedef struct {
    unsigned int b;
 } ii;
 
+volatile int y = 0;
+
 __attribute__ ((noinline)) int
 main1 (s *arr, ii *iarr)
 {
@@ -62,8 +64,8 @@  int main (void)
       arr[i].b = i * 2;
       iarr[i].a = i;
       iarr[i].b = i * 3;
-      if (arr[i].a == 178)
-         abort();
+      if (y) /* Avoid vectorization.  */
+        abort ();
     }
 
   main1 (arr, iarr);
Index: testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap2-big-array.c
===================================================================
--- testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap2-big-array.c	(revision 196816)
+++ testsuite/gcc.dg/vect/vect-strided-a-u8-i8-gap2-big-array.c	(working copy)
@@ -16,6 +16,8 @@  typedef struct {
    unsigned char h;
 } s;
 
+volatile int y = 0;
+
 __attribute__ ((noinline)) int
 main1 ()
 {
@@ -45,8 +47,8 @@  main1 ()
       check_res[i].h = arr[i].f;
       check_res[i].g = arr[i].f - arr[i].a;
 
-      if (arr[i].a == 178)
-         abort ();
+      if (y) /* Avoid vectorization.  */
+        abort ();
     }
 
   for (i = 0; i < N; i++)