A recursive edge divided for self-generating clones can disagree with
its basic block. The block is not updated, because the function body
is not available at WPA. The verifier ignores that mismatch now when
the count is IPA. Only -fprofile-partial-training turns it into a
local count. Skip that check in verify_cgraph_node.
Bootstrapped and regression tested on aarch64-linux-gnu. Also tested
Spec2026 intrate and fprate with and without -fprofile-partial-training.
gcc/ChangeLog:
* cgraph.cc (cgraph_node::verify_node): Do not require a local
edge count to match its block under
-fprofile-partial-training.
Signed-off-by: Kugan Vivekanandarajah <[email protected]>
---
gcc/cgraph.cc | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/gcc/cgraph.cc b/gcc/cgraph.cc
index 8e349189724..160d5793266 100644
--- a/gcc/cgraph.cc
+++ b/gcc/cgraph.cc
@@ -4146,6 +4146,10 @@ cgraph_node::verify_node (void)
BUILT_IN_UNREACHABLE_TRAP))
&& count
== ENTRY_BLOCK_PTR_FOR_FN (DECL_STRUCT_FUNCTION (decl))->count
+ /* Partial training can turn an IPA-adjusted edge into a local
+ estimate without making the corresponding WPA adjustment to
+ the basic block, whose body is not available at that point. */
+ && !opt_for_fn (decl, flag_profile_partial_training)
&& (!e->count.ipa_p ()
&& e->count.differs_from_p (gimple_bb (e->call_stmt)->count)))
{
--
2.34.1