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)
/* Handle the case that an inner ancestor:1 target is called by an outer
target region. */
- if (!is_ancestor)
- cgraph_node::get (child_fn)->calls_declare_variant_alt
- |= cgraph_node::get (cfun->decl)->calls_declare_variant_alt;
- else /* Duplicate function to create empty nonhost variant. */
+ if (is_ancestor)
{
- /* Enable pass_omp_device_lower pass. */
- cgraph_node::get (cfun->decl)->calls_declare_variant_alt = 1;
cgraph_node *fn2_node;
child_fn2 = build_decl (DECL_SOURCE_LOCATION (child_fn),
FUNCTION_DECL,
TREE_PUBLIC (child_fn2) = 0;
DECL_UNINLINABLE (child_fn2) = 1;
DECL_EXTERNAL (child_fn2) = 0;
- DECL_CONTEXT (child_fn2) = NULL_TREE;
+ DECL_CONTEXT (child_fn2) = DECL_CONTEXT (child_fn);
DECL_INITIAL (child_fn2) = make_node (BLOCK);
BLOCK_SUPERCONTEXT (DECL_INITIAL (child_fn2)) = child_fn2;
DECL_ATTRIBUTES (child_fn)
fn2_node->force_output = 1;
node->offloadable = 0;
+ /* Enable pass_omp_device_lower pass. */
+ fn2_node = cgraph_node::get (DECL_CONTEXT (child_fn));
+ fn2_node->calls_declare_variant_alt = 1;
+
t = build_decl (DECL_SOURCE_LOCATION (child_fn),
RESULT_DECL, NULL_TREE, void_type_node);
DECL_ARTIFICIAL (t) = 1;
--- /dev/null
+! PR middle-end/107236
+
+! Did ICE before because IFN .GOMP_TARGET_REV was not
+! processed in omp-offload.cc.
+! Note: Test required ENABLE_OFFLOADING being true inside GCC.
+
+implicit none
+!$omp requires reverse_offload
+!$omp target parallel num_threads(4)
+ !$omp target device(ancestor:1)
+ call foo()
+ !$omp end target
+!$omp end target parallel
+contains
+ subroutine foo
+ end
+end