diff options
author | Tom de Vries <tom@codesourcery.com> | 2018-03-26 09:45:49 +0000 |
---|---|---|
committer | Tom de Vries <vries@gcc.gnu.org> | 2018-03-26 09:45:49 +0000 |
commit | 46dbeb4085e4a5492579d06641d0aae25b80b465 (patch) | |
tree | 2e2968f8a5a77268b1d31ec7e2c78a3ac5a6014f /gcc/omp-general.c | |
parent | c2f3aac4541abf92c5a3554f77c58dcb5e68413d (diff) | |
download | gcc-46dbeb4085e4a5492579d06641d0aae25b80b465.zip gcc-46dbeb4085e4a5492579d06641d0aae25b80b465.tar.gz gcc-46dbeb4085e4a5492579d06641d0aae25b80b465.tar.bz2 |
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
Diffstat (limited to 'gcc/omp-general.c')
-rw-r--r-- | gcc/omp-general.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/omp-general.c b/gcc/omp-general.c index 3ef6ce7..cabbbbc 100644 --- a/gcc/omp-general.c +++ b/gcc/omp-general.c @@ -612,6 +612,16 @@ oacc_get_fn_attrib (tree fn) return lookup_attribute (OACC_FN_ATTRIB, DECL_ATTRIBUTES (fn)); } +/* Return true if FN is an OpenMP or OpenACC offloading function. */ + +bool +offloading_function_p (tree fn) +{ + tree attrs = DECL_ATTRIBUTES (fn); + return (lookup_attribute ("omp declare target", attrs) + || lookup_attribute ("omp target entrypoint", attrs)); +} + /* Extract an oacc execution dimension from FN. FN must be an offloaded function or routine that has already had its execution dimensions lowered to the target-specific values. */ |