#pragma target and optimize should also apply to implicitly-generated
functions like static initialization functions and defaulted special member
functions.
The handle_optimize_attribute change is necessary to avoid regressing
g++.dg/opt/pr105306.C; maybe_clone_body creates a cgraph_node for the ~B
alias before handle_optimize_attribute, and the alias never goes through
finalize_function, so we need to adjust semantic_interposition somewhere
else.
PR c++/109753
gcc/c-family/ChangeLog:
* c-attribs.cc (handle_optimize_attribute): Set
cgraph_node::semantic_interposition.
gcc/cp/ChangeLog:
* decl.cc (start_preparsed_function): Call decl_attributes.
gcc/testsuite/ChangeLog:
* g++.dg/opt/always_inline1.C: New test.
if (prev_target_node != target_node)
DECL_FUNCTION_SPECIFIC_TARGET (*node) = target_node;
+ /* Also update the cgraph_node, if it's already built. */
+ if (cgraph_node *cn = cgraph_node::get (*node))
+ cn->semantic_interposition = flag_semantic_interposition;
+
/* Restore current options. */
cl_optimization_restore (&global_options, &global_options_set,
&cur_opts);
doing_friend = true;
}
+ /* Adjust for #pragma target/optimize. */
+ decl_attributes (&decl1, NULL_TREE, 0);
+
if (DECL_DECLARED_INLINE_P (decl1)
&& lookup_attribute ("noinline", attrs))
warning_at (DECL_SOURCE_LOCATION (decl1), 0,
--- /dev/null
+// PR c++/109753
+// { dg-do compile { target x86_64-*-* } }
+
+#pragma GCC target("avx2")
+struct aa {
+ __attribute__((__always_inline__)) aa() {}
+};
+aa _M_impl;