[PATCH] [AutoFDO] fix AutoFDO inlined target matching

Kugan Vivekanandarajah <[email protected]> Tue, 4 Aug 2026 10:28:45 +1000
Newsgroups gmane.comp.gcc.patches
Message-ID <[email protected]>
This fixes a typo. The symbol-name comparison loop never executed because
its condition was the loop index itself.  Compare matching characters
until either name ends so stripped clone suffixes can be recognized.

gcc/ChangeLog:

	* auto-profile.cc (match_with_target): Fix the symbol-name comparison
	loop.

Regression tested on aarch64-linux-gnu with no new regressions

Signed-off-by: Kugan Vivekanandarajah <[email protected]>
---
 gcc/auto-profile.cc | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/gcc/auto-profile.cc b/gcc/auto-profile.cc
index f4562d7f2f98..ca83bca40726 100644
--- a/gcc/auto-profile.cc
+++ b/gcc/auto-profile.cc
@@ -1572,10 +1572,8 @@ match_with_target (cgraph_node *n,
     {
       int i;
       bool in_suffix = false;
-      for (i = 0; i; i++)
+      for (i = 0; name[i] && name[i] == symbol_name[i]; i++)
 	{
-	  if (name[i] != symbol_name[i])
-	    break;
 	  if (name[i] == '.')
 	    in_suffix = true;
 	}
-- 
2.34.1