Fix switch conversion in offloading functions
authorTom de Vries <tom@codesourcery.com>
Mon, 26 Mar 2018 09:45:49 +0000 (09:45 +0000)
committerTom de Vries <vries@gcc.gnu.org>
Mon, 26 Mar 2018 09:45:49 +0000 (09:45 +0000)
commit46dbeb4085e4a5492579d06641d0aae25b80b465
tree2e2968f8a5a77268b1d31ec7e2c78a3ac5a6014f
parentc2f3aac4541abf92c5a3554f77c58dcb5e68413d
Fix switch conversion in offloading functions

2018-03-26  Tom de Vries  <tom@codesourcery.com>

PR tree-optimization/85063
* omp-general.c (offloading_function_p): New function.  Factor out
of ...
* omp-offload.c (pass_omp_target_link::gate): ... here.
* omp-general.h (offloading_function_p): Declare.
* tree-switch-conversion.c (build_one_array): Mark CSWTCH.x variable
with attribute omp declare target for offloading functions.

* testsuite/libgomp.c/switch-conversion-2.c: New test.
* testsuite/libgomp.c/switch-conversion.c: New test.
* testsuite/libgomp.oacc-c-c++-common/switch-conversion-2.c: New test.
* testsuite/libgomp.oacc-c-c++-common/switch-conversion.c: New test.

From-SVN: r258852
gcc/ChangeLog
gcc/omp-general.c
gcc/omp-general.h
gcc/omp-offload.c
gcc/tree-switch-conversion.c
libgomp/ChangeLog
libgomp/testsuite/libgomp.c/switch-conversion-2.c [new file with mode: 0644]
libgomp/testsuite/libgomp.c/switch-conversion.c [new file with mode: 0644]
libgomp/testsuite/libgomp.oacc-c-c++-common/switch-conversion-2.c [new file with mode: 0644]
libgomp/testsuite/libgomp.oacc-c-c++-common/switch-conversion.c [new file with mode: 0644]