[openacc] Don't gimplify in ssa mode if seen_error in oacc_xform_loop

Message ID 338501dd-e89c-b2ac-8d84-58773b72e485@codesourcery.com
State New
Headers show
Series
  • [openacc] Don't gimplify in ssa mode if seen_error in oacc_xform_loop
Related show

Commit Message

Cesar Philippidis Sept. 26, 2018, 6:28 p.m.
Again, this is another old gomp4 patch without a corresponding test
case. I'm not familiar enough with the parloops kernels implementation
to know if this patch is important. However, I'm somewhat inclined to
drop patches from OG8 that don't impact correctness in the test suite.

What do you want to do with this patch Thomas? I bootstrapped and
regtested it for x86_64 Linux with nvptx offloading.

Cesar

Patch

[OpenACC] Don't gimplify in ssa mode if seen_error in oacc_xform_loop

2018-XX-YY  Tom de Vries  <tdevries@suse.de>
	    Cesar Philippidis  <cesar@codesourcery.com>

	gcc/
	PR tree-optimization/68977
	* omp-offload.c (oacc_xform_loop): Handle seen_error () == true.

(cherry picked from gomp-4_0-branch r232343 and r232344)
---

diff --git a/gcc/omp-offload.c b/gcc/omp-offload.c
index 3582dda3d1a..dae284fe890 100644
--- a/gcc/omp-offload.c
+++ b/gcc/omp-offload.c
@@ -335,7 +335,12 @@  oacc_xform_loop (gcall *call)
        -> chunks=ceil (range/(chunksize*threads*step))
      striding=false,chunking=false
        -> chunk_size=ceil(range/(threads*step)),chunks=1  */
-  push_gimplify_context (true);
+
+  /* If seen_error (), we may introduce an uninitialized var due to
+     gimplification bailing out.  If we gimplify in ssa mode, that will cause an
+     ICE.  If we gimplify in non-ssa mode, then ssa updating will turn it into a
+     default definition, and we avoid the ICE.  */
+  push_gimplify_context (!seen_error ());
 
   switch (code)
     {
-- 
2.17.1