aboutsummaryrefslogtreecommitdiff
path: root/gcc/ipa-inline.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2021-06-22 10:09:01 +0200
committerMartin Liska <mliska@suse.cz>2021-09-07 11:47:57 +0200
commitaad72d2ea8378e1a56c00d15daa4bdcac8a5ae39 (patch)
tree014cea958a00d2af2df6d7a5fa2e79925068c582 /gcc/ipa-inline.c
parentf387ff788f63c1974479644edae728047f843ec4 (diff)
downloadgcc-aad72d2ea8378e1a56c00d15daa4bdcac8a5ae39.zip
gcc-aad72d2ea8378e1a56c00d15daa4bdcac8a5ae39.tar.gz
gcc-aad72d2ea8378e1a56c00d15daa4bdcac8a5ae39.tar.bz2
inline: do not einline when no_profile_instrument_function is different
PR gcov-profile/80223 gcc/ChangeLog: * ipa-inline.c (can_inline_edge_p): Similarly to sanitizer options, do not inline when no_profile_instrument_function attributes are different in early inliner. It's fine to inline it after PGO instrumentation. gcc/testsuite/ChangeLog: * gcc.dg/no_profile_instrument_function-attr-2.c: New test.
Diffstat (limited to 'gcc/ipa-inline.c')
-rw-r--r--gcc/ipa-inline.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index 413446b..012b326 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -396,6 +396,23 @@ can_inline_edge_p (struct cgraph_edge *e, bool report,
e->inline_failed = CIF_SANITIZE_ATTRIBUTE_MISMATCH;
inlinable = false;
}
+ else if (profile_arc_flag
+ && (lookup_attribute ("no_profile_instrument_function",
+ DECL_ATTRIBUTES (caller->decl)) == NULL_TREE)
+ != (lookup_attribute ("no_profile_instrument_function",
+ DECL_ATTRIBUTES (callee->decl)) == NULL_TREE))
+ {
+ cgraph_node *origin = caller;
+ while (origin->clone_of)
+ origin = origin->clone_of;
+
+ if (!DECL_STRUCT_FUNCTION (origin->decl)->always_inline_functions_inlined)
+ {
+ e->inline_failed = CIF_UNSPECIFIED;
+ inlinable = false;
+ }
+ }
+
if (!inlinable && report)
report_inline_failed_reason (e);
return inlinable;