Skip to content

llvm-tli-checker: Print custom name instead of standard name #142537

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: users/arsenm/target-library-info/add-tests-of-tli-checker-output
Choose a base branch
from

Conversation

arsenm
Copy link
Contributor

@arsenm arsenm commented Jun 3, 2025

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.

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.
Copy link
Contributor Author

arsenm commented Jun 3, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@arsenm arsenm added the llvm-tools All llvm tools that do not have corresponding tag label Jun 3, 2025 — with Graphite App
@arsenm arsenm marked this pull request as ready for review June 3, 2025 06:00
@llvmbot
Copy link
Member

llvmbot commented Jun 3, 2025

@llvm/pr-subscribers-llvm-analysis

Author: Matt Arsenault (arsenm)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/142537.diff

5 Files Affected:

  • (modified) llvm/test/Analysis/TargetLibraryInfo/arm64_32-apple-watchos.test (+2-2)
  • (modified) llvm/test/Analysis/TargetLibraryInfo/armv7s-apple-ios7.0.test (+2-2)
  • (modified) llvm/test/Analysis/TargetLibraryInfo/i386-apple-macosx10.7.0.test (+2-2)
  • (modified) llvm/test/Analysis/TargetLibraryInfo/x86_64-pc-windows-msvc17.test (+5-5)
  • (modified) llvm/tools/llvm-tli-checker/llvm-tli-checker.cpp (+13-3)
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';
   }
 }
 


if (IsAvailable) {
StringRef Name = TLI.getName(LF);
// If there is a custom name, print it.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// If there is a custom name, print it.
// Print the (possibly custom) name.

@pogo59
Copy link
Collaborator

pogo59 commented Jun 4, 2025

Seems reasonable, LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
llvm:analysis llvm-tools All llvm tools that do not have corresponding tag
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants