Hi!

As the testcase shows, offset{1,2} can be NULL and operand_equal_p doesn't
like NULL arguments.  If both are NULL, we should return true, if just one,
we should return false.

Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk.

2019-06-27  Jakub Jelinek  <ja...@redhat.com>

        PR tree-optimization/91010
        * tree-vect-stmts.c (scan_operand_equal_p): If offset1 == offset2,
        return true.  Otherwise, don't call operand_equal_p if offset1 or
        offset2 is NULL and just return false.

        * g++.dg/vect/simd-10.cc: New test.

--- gcc/tree-vect-stmts.c.jj    2019-06-25 08:58:02.019417742 +0200
+++ gcc/tree-vect-stmts.c       2019-06-27 10:20:09.658616378 +0200
@@ -6347,7 +6347,10 @@ scan_operand_equal_p (tree ref1, tree re
     return false;
   if (maybe_ne (bitsize1, bitsize2))
     return false;
-  if (!operand_equal_p (offset1, offset2, 0))
+  if (offset1 != offset2
+      && (!offset1
+         || !offset2
+         || !operand_equal_p (offset1, offset2, 0)))
     return false;
   return true;
 }
--- gcc/testsuite/g++.dg/vect/simd-10.cc.jj     2019-06-27 10:12:44.828471845 
+0200
+++ gcc/testsuite/g++.dg/vect/simd-10.cc        2019-06-27 10:24:52.152262921 
+0200
@@ -0,0 +1,8 @@
+// PR tree-optimization/91010
+// { dg-do compile }
+// { dg-require-effective-target size32plus }
+// { dg-additional-options "-fopenmp-simd -fno-tree-forwprop" }
+// { dg-additional-options "-mavx" { target avx_runtime } }
+// { dg-final { scan-tree-dump-times "vectorized \[1-3] loops" 2 "vect" { 
target i?86-*-* x86_64-*-* } } }
+
+#include "simd-5.cc"

        Jakub

Reply via email to