diff mbox series

[committed] Don't add CLOBBERs for "omp simd array" vars (PR tree-optimization/89027)

Message ID 20190124192154.GQ30353@tucnak
State New
Headers show
Series [committed] Don't add CLOBBERs for "omp simd array" vars (PR tree-optimization/89027) | expand

Commit Message

Jakub Jelinek Jan. 24, 2019, 7:21 p.m. UTC
Hi!

During the vectorizer pass, these magic arrays can be shrink, but the code
doing so expects they are accessed only as array elts, not as whole arrays,
so if there is a clobber for them, it causes checking failure.

It isn't worth adding that support now, so this patch just makes sure we
don't add clobbers for them (the vars are added post gimplification, so the
usual spots to add clobbers don't affect them).

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

2019-01-24  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/89027
	* tree-inline.c (add_clobbers_to_eh_landing_pad): Don't add clobbers
	for "omp simd array" variables.

	* gfortran.dg/gomp/pr89027.f90: New test.


	Jakub
diff mbox series

Patch

--- gcc/tree-inline.c.jj	2019-01-18 11:06:53.528717109 +0100
+++ gcc/tree-inline.c	2019-01-24 10:13:26.115726681 +0100
@@ -2204,7 +2204,8 @@  add_clobbers_to_eh_landing_pad (basic_bl
 	&& !TREE_THIS_VOLATILE (var)
 	&& !DECL_HAS_VALUE_EXPR_P (var)
 	&& !is_gimple_reg (var)
-	&& auto_var_in_fn_p (var, id->src_fn))
+	&& auto_var_in_fn_p (var, id->src_fn)
+	&& !lookup_attribute ("omp simd array", DECL_ATTRIBUTES (var)))
       {
 	tree *t = id->decl_map->get (var);
 	if (!t)
--- gcc/testsuite/gfortran.dg/gomp/pr89027.f90.jj	2019-01-24 10:52:22.607364607 +0100
+++ gcc/testsuite/gfortran.dg/gomp/pr89027.f90	2019-01-24 10:52:02.184700058 +0100
@@ -0,0 +1,22 @@ 
+! PR tree-optimization/89027
+! { dg-do compile }
+! { dg-additional-options "-O2 -fexceptions -fno-tree-dce" }
+
+subroutine bar
+  integer :: a, b
+  a = 1
+  b = 2
+  call foo
+contains
+  subroutine foo
+!$omp simd linear(a:2) linear(b:1)
+    do a = 1, 20, 2
+      b = b + 1
+    end do
+!$omp end simd
+    if (a /= 21 .or. b /= 12) STOP 1
+!$omp task depend(out : a)
+    a = a + 1
+!$omp end task
+  end subroutine foo
+end subroutine bar