aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraphclones.cc
diff options
context:
space:
mode:
authorTobias Burnus <tobias@codesourcery.com>2022-10-24 15:19:00 +0200
committerTobias Burnus <tobias@codesourcery.com>2022-10-24 15:19:00 +0200
commit178ac530fe67e4f2fc439cc4ce89bc19d571ca31 (patch)
tree3cc708fdbbbf527804a9b46c3f596a14e442d314 /gcc/cgraphclones.cc
parent97d1ed67fc6a5773c8c00875bfa3616a457cf5f9 (diff)
downloadgcc-178ac530fe67e4f2fc439cc4ce89bc19d571ca31.zip
gcc-178ac530fe67e4f2fc439cc4ce89bc19d571ca31.tar.gz
gcc-178ac530fe67e4f2fc439cc4ce89bc19d571ca31.tar.bz2
OpenMP: Fix reverse offload GOMP_TARGET_REV IFN corner cases [PR107236]
For 'target parallel' and similarly nested directives, cgraph_node's calls_declare_variant_alt was not set in the parent region node but in cfun->decl. Hence, pass_omp_device_lower did not process handle the internal function GOMP_TARGET_REV. - Solution is to set it to the DECL_CONTEXT, which is set in adjust_context_and_scope. The cgraph_node::create_clone issue is exposed with -O2 for the existing libgomp.fortran/reverse-offload-1.f90. PR middle-end/107236 gcc/ChangeLog: * omp-expand.cc (expand_omp_target): Set calls_declare_variant_alt in DECL_CONTEXT and not to cfun->decl. * cgraphclones.cc (cgraph_node::create_clone): Copy also the node's calls_declare_variant_alt value. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/target-device-ancestor-6.f90: New test.
Diffstat (limited to 'gcc/cgraphclones.cc')
-rw-r--r--gcc/cgraphclones.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/cgraphclones.cc b/gcc/cgraphclones.cc
index eb0fa87..bb4b3c5 100644
--- a/gcc/cgraphclones.cc
+++ b/gcc/cgraphclones.cc
@@ -375,6 +375,7 @@ cgraph_node::create_clone (tree new_decl, profile_count prof_count,
if (!new_inlined_to)
prof_count = count.combine_with_ipa_count (prof_count);
new_node->count = prof_count;
+ new_node->calls_declare_variant_alt = this->calls_declare_variant_alt;
/* Update IPA profile. Local profiles need no updating in original. */
if (update_original)