This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[committed] Fix vect_analyze_data_refs (PR middle-end/59670)


Hi!

I forgot to check is_gimple_call before checking gimple_call_internal_p.
Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
committed as obvious.

2014-01-09  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/59670
	* tree-vect-data-refs.c (vect_analyze_data_refs): Check
	is_gimple_call before calling gimple_call_internal_p.

	* gcc.dg/pr59670.c: New test.

--- gcc/tree-vect-data-refs.c.jj	2014-01-03 11:40:57.000000000 +0100
+++ gcc/tree-vect-data-refs.c	2014-01-09 18:32:11.051319627 +0100
@@ -3320,9 +3320,10 @@ again:
 			    {
 			      gimple def = SSA_NAME_DEF_STMT (off);
 			      tree reft = TREE_TYPE (DR_REF (newdr));
-			      if (gimple_call_internal_p (def)
-				  && gimple_call_internal_fn (def)
-				  == IFN_GOMP_SIMD_LANE)
+			      if (is_gimple_call (def)
+				  && gimple_call_internal_p (def)
+				  && (gimple_call_internal_fn (def)
+				      == IFN_GOMP_SIMD_LANE))
 				{
 				  tree arg = gimple_call_arg (def, 0);
 				  gcc_assert (TREE_CODE (arg) == SSA_NAME);
--- gcc/testsuite/gcc.dg/pr59670.c.jj	2014-01-09 18:36:15.184067750 +0100
+++ gcc/testsuite/gcc.dg/pr59670.c	2014-01-09 18:36:02.000000000 +0100
@@ -0,0 +1,15 @@
+/* PR middle-end/59670 */
+/* { dg-do compile } */
+/* { dg-options "-O1 -fopenmp-simd" } */
+
+int d[1024];
+
+int
+foo (int j, int b)
+{
+  int l, c = 0;
+#pragma omp simd reduction(+: c)
+  for (l = 0; l < b; ++l)
+    c += d[j + l];
+  return c;
+}

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]