public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] Don't add CLOBBERs for "omp simd array" vars (PR tree-optimization/89027)
@ 2019-01-24 19:28 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2019-01-24 19:28 UTC (permalink / raw)
  To: gcc-patches

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.

--- 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

	Jakub

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-01-24 19:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-24 19:28 [committed] Don't add CLOBBERs for "omp simd array" vars (PR tree-optimization/89027) Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).