diff mbox

Fix PR66823

Message ID alpine.LSU.2.11.1507100949220.9923@zhemvz.fhfr.qr
State New
Headers show

Commit Message

Richard Biener July 10, 2015, 7:51 a.m. UTC
On Thu, 9 Jul 2015, Richard Biener wrote:

> 
> The following fixes a stupid bug with -ftree-loop-if-convert-stores.
> We were treating all but the same base as candidate to determine
> whether a ref was accessed unconditionally ...
> 
> Bootstrap & regtest running on x86_64-unknown-linux-gnu.

Applied as follows, with gcc.dg/vect/pr61194.c adjusted which
now FAILs because in

  int i;
  for (i=0; i<1024; ++i)
    z[i] = ((x[i]>0) & (w[i]<0)) ? z[i] : y[i];

while z[i] is correctly identified as not trapping because
it is written to unconditionally, y[i] is not (but was
previously as any of the unconditional accesses to
x[i], w[i] or z[i] counted as that).

Applied to trunk.

2015-07-10  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/66823
	* tree-if-conv.c (memrefs_read_or_written_unconditionally): Fix
	inverted predicate.

	* gcc.dg/vect/pr61194.c: Remove -ftree-loop-if-convert-stores
	which should not be necessary.  XFAIL.
diff mbox

Patch

Index: gcc/tree-if-conv.c
===================================================================
--- gcc/tree-if-conv.c	(revision 225610)
+++ gcc/tree-if-conv.c	(working copy)
@@ -642,7 +642,7 @@  memrefs_read_or_written_unconditionally
                    || TREE_CODE (ref_base_b) == REALPART_EXPR)
               ref_base_b = TREE_OPERAND (ref_base_b, 0);
 
-  	    if (!operand_equal_p (ref_base_a, ref_base_b, 0))
+  	    if (operand_equal_p (ref_base_a, ref_base_b, 0))
 	      {
 	        tree cb = bb_predicate (gimple_bb (DR_STMT (b)));
 
Index: gcc/testsuite/gcc.dg/vect/pr61194.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/pr61194.c	(revision 225610)
+++ gcc/testsuite/gcc.dg/vect/pr61194.c	(working copy)
@@ -1,5 +1,4 @@ 
 /* { dg-require-effective-target vect_cond_mixed } */
-/* { dg-additional-options "-ftree-loop-if-convert-stores" } */
 
 #include "tree-vect.h"
 
@@ -39,4 +38,4 @@  int main()
   return 0;
 }
 
-/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail *-*-* } } } */