[llvm] RuntimeLibcalls: Fix missing const on getLibcallNames (PR #143074)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 6 06:16:55 PDT 2025
https://github.com/arsenm updated https://github.com/llvm/llvm-project/pull/143074
>From 7f45ef606b638b1b9921b51896af7a985c136971 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Fri, 6 Jun 2025 15:07:01 +0900
Subject: [PATCH 1/2] RuntimeLibcalls: Fix missing const on getLibcallNames
This is made simpler by just returning the array ref instead of
the fancy range.
---
llvm/include/llvm/IR/RuntimeLibcalls.h | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.h b/llvm/include/llvm/IR/RuntimeLibcalls.h
index 89e466ee5933d..3bf41062660c1 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.h
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.h
@@ -81,10 +81,7 @@ struct RuntimeLibcallsInfo {
return LibcallCallingConvs[Call];
}
- iterator_range<const char **> getLibcallNames() {
- return llvm::make_range(LibcallRoutineNames,
- LibcallRoutineNames + RTLIB::UNKNOWN_LIBCALL);
- }
+ ArrayRef<const char *> getLibcallNames() const { return LibcallRoutineNames; }
private:
/// Stores the name each libcall.
>From 16b0b3e29038bfc379e23adbfc1e9494bd2d97fb Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Fri, 6 Jun 2025 22:15:49 +0900
Subject: [PATCH 2/2] use drop_back
---
llvm/include/llvm/IR/RuntimeLibcalls.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.h b/llvm/include/llvm/IR/RuntimeLibcalls.h
index 3bf41062660c1..051bcc147cb71 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.h
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.h
@@ -81,7 +81,10 @@ struct RuntimeLibcallsInfo {
return LibcallCallingConvs[Call];
}
- ArrayRef<const char *> getLibcallNames() const { return LibcallRoutineNames; }
+ ArrayRef<const char *> getLibcallNames() const {
+ // Trim UNKNOWN_LIBCALL from the end
+ return ArrayRef(LibcallRoutineNames).drop_back();
+ }
private:
/// Stores the name each libcall.
More information about the llvm-commits
mailing list