https://github.com/arsenm created 
https://github.com/llvm/llvm-project/pull/142537

Previously this always printed the standard name if the function
was available, leaving any custom name override untested. Print the
target's name instead. The message should possibly include the standard
name for reference.

>From 52efdd8cb4cda57363a5bf868cae7ca82bd04513 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <matthew.arsena...@amd.com>
Date: Mon, 2 Jun 2025 14:40:54 +0200
Subject: [PATCH] llvm-tli-checker: Print custom name instead of standard name

Previously this always printed the standard name if the function
was available, leaving any custom name override untested. Print the
target's name instead. The message should possibly include the standard
name for reference.
---
 .../arm64_32-apple-watchos.test                  |  4 ++--
 .../TargetLibraryInfo/armv7s-apple-ios7.0.test   |  4 ++--
 .../i386-apple-macosx10.7.0.test                 |  4 ++--
 .../x86_64-pc-windows-msvc17.test                | 10 +++++-----
 llvm/tools/llvm-tli-checker/llvm-tli-checker.cpp | 16 +++++++++++++---
 5 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/llvm/test/Analysis/TargetLibraryInfo/arm64_32-apple-watchos.test 
b/llvm/test/Analysis/TargetLibraryInfo/arm64_32-apple-watchos.test
index 1878911ac85be..018ec131eebc9 100644
--- a/llvm/test/Analysis/TargetLibraryInfo/arm64_32-apple-watchos.test
+++ b/llvm/test/Analysis/TargetLibraryInfo/arm64_32-apple-watchos.test
@@ -229,8 +229,8 @@ CHECK-NEXT: available: 'execve'
 CHECK-NEXT: available: 'execvp'
 CHECK-NEXT: available: 'execvpe'
 CHECK-NEXT: available: 'exp'
-CHECK-NEXT: available: 'exp10'
-CHECK-NEXT: available: 'exp10f'
+CHECK-NEXT: available: '__exp10'
+CHECK-NEXT: available: '__exp10f'
 CHECK-NEXT: not available: 'exp10l'
 CHECK-NEXT: available: 'exp2'
 CHECK-NEXT: available: 'exp2f'
diff --git a/llvm/test/Analysis/TargetLibraryInfo/armv7s-apple-ios7.0.test 
b/llvm/test/Analysis/TargetLibraryInfo/armv7s-apple-ios7.0.test
index 03cb8c6915331..71b731f7927cb 100644
--- a/llvm/test/Analysis/TargetLibraryInfo/armv7s-apple-ios7.0.test
+++ b/llvm/test/Analysis/TargetLibraryInfo/armv7s-apple-ios7.0.test
@@ -229,8 +229,8 @@ CHECK-NEXT: available: 'execve'
 CHECK-NEXT: available: 'execvp'
 CHECK-NEXT: available: 'execvpe'
 CHECK-NEXT: available: 'exp'
-CHECK-NEXT: available: 'exp10'
-CHECK-NEXT: available: 'exp10f'
+CHECK-NEXT: available: '__exp10'
+CHECK-NEXT: available: '__exp10f'
 CHECK-NEXT: not available: 'exp10l'
 CHECK-NEXT: available: 'exp2'
 CHECK-NEXT: available: 'exp2f'
diff --git a/llvm/test/Analysis/TargetLibraryInfo/i386-apple-macosx10.7.0.test 
b/llvm/test/Analysis/TargetLibraryInfo/i386-apple-macosx10.7.0.test
index cb7b0b176905e..cfeba5fe2bbd8 100644
--- a/llvm/test/Analysis/TargetLibraryInfo/i386-apple-macosx10.7.0.test
+++ b/llvm/test/Analysis/TargetLibraryInfo/i386-apple-macosx10.7.0.test
@@ -286,7 +286,7 @@ CHECK-NEXT: available: 'fork'
 CHECK-NEXT: available: 'fprintf'
 CHECK-NEXT: available: 'fputc'
 CHECK-NEXT: not available: 'fputc_unlocked'
-CHECK-NEXT: available: 'fputs'
+CHECK-NEXT: available: 'fputs$UNIX2003'
 CHECK-NEXT: not available: 'fputs_unlocked'
 CHECK-NEXT: available: 'fread'
 CHECK-NEXT: not available: 'fread_unlocked'
@@ -308,7 +308,7 @@ CHECK-NEXT: available: 'ftello'
 CHECK-NEXT: not available: 'ftello64'
 CHECK-NEXT: available: 'ftrylockfile'
 CHECK-NEXT: available: 'funlockfile'
-CHECK-NEXT: available: 'fwrite'
+CHECK-NEXT: available: 'fwrite$UNIX2003'
 CHECK-NEXT: not available: 'fwrite_unlocked'
 CHECK-NEXT: available: 'getc'
 CHECK-NEXT: available: 'getc_unlocked'
diff --git a/llvm/test/Analysis/TargetLibraryInfo/x86_64-pc-windows-msvc17.test 
b/llvm/test/Analysis/TargetLibraryInfo/x86_64-pc-windows-msvc17.test
index 2653cba3a0271..5ebbbd7c26415 100644
--- a/llvm/test/Analysis/TargetLibraryInfo/x86_64-pc-windows-msvc17.test
+++ b/llvm/test/Analysis/TargetLibraryInfo/x86_64-pc-windows-msvc17.test
@@ -190,7 +190,7 @@ CHECK-NEXT: available: 'atoll'
 CHECK-NEXT: not available: 'bcmp'
 CHECK-NEXT: not available: 'bcopy'
 CHECK-NEXT: not available: 'bzero'
-CHECK-NEXT: available: 'cabs'
+CHECK-NEXT: available: '_cabs'
 CHECK-NEXT: not available: 'cabsf'
 CHECK-NEXT: not available: 'cabsl'
 CHECK-NEXT: available: 'calloc'
@@ -204,8 +204,8 @@ CHECK-NEXT: not available: 'chmod'
 CHECK-NEXT: not available: 'chown'
 CHECK-NEXT: available: 'clearerr'
 CHECK-NEXT: not available: 'closedir'
-CHECK-NEXT: available: 'copysign'
-CHECK-NEXT: available: 'copysignf'
+CHECK-NEXT: available: '_copysign'
+CHECK-NEXT: available: '_copysignf'
 CHECK-NEXT: not available: 'copysignl'
 CHECK-NEXT: available: 'cos'
 CHECK-NEXT: available: 'cosf'
@@ -347,8 +347,8 @@ CHECK-NEXT: not available: 'log2l'
 CHECK-NEXT: not available: 'ilogb'
 CHECK-NEXT: not available: 'ilogbf'
 CHECK-NEXT: not available: 'ilogbl'
-CHECK-NEXT: available: 'logb'
-CHECK-NEXT: available: 'logbf'
+CHECK-NEXT: available: '_logb'
+CHECK-NEXT: available: '_logbf'
 CHECK-NEXT: not available: 'logbl'
 CHECK-NEXT: available: 'logf'
 CHECK-NEXT: not available: 'logl'
diff --git a/llvm/tools/llvm-tli-checker/llvm-tli-checker.cpp 
b/llvm/tools/llvm-tli-checker/llvm-tli-checker.cpp
index bc20386987cae..725fe7138509d 100644
--- a/llvm/tools/llvm-tli-checker/llvm-tli-checker.cpp
+++ b/llvm/tools/llvm-tli-checker/llvm-tli-checker.cpp
@@ -131,10 +131,20 @@ static void dumpTLIEntries(const TargetLibraryInfo &TLI) {
   for (unsigned FI = 0; FI != LibFunc::NumLibFuncs; ++FI) {
     LibFunc LF = static_cast<LibFunc>(FI);
     bool IsAvailable = TLI.has(LF);
-    StringRef FuncName = TargetLibraryInfo::getStandardName(LF);
 
-    outs() << (IsAvailable ? "    " : "not ")
-           << "available: " << getPrintableName(FuncName) << '\n';
+    outs() << (IsAvailable ? "    " : "not ") << "available: ";
+
+    if (IsAvailable) {
+      StringRef Name = TLI.getName(LF);
+      // If there is a custom name, print it.
+      // TODO: Should we include the standard name in the printed line?
+      outs() << getPrintableName(Name);
+    } else {
+      // If it's not available, refer to it by the standard name.
+      outs() << getPrintableName(TargetLibraryInfo::getStandardName(LF));
+    }
+
+    outs() << '\n';
   }
 }
 

_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to