[llvm] 3aa516e - [llvm-exegesis] Fix unused variable warning on non-linux platforms
Aiden Grossman via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 29 17:38:01 PST 2023
Author: Aiden Grossman
Date: 2023-12-29T17:33:40-08:00
New Revision: 3aa516e4f1046a8cb68c5cfc3778339ff74a8cfe
URL: https://github.com/llvm/llvm-project/commit/3aa516e4f1046a8cb68c5cfc3778339ff74a8cfe
DIFF: https://github.com/llvm/llvm-project/commit/3aa516e4f1046a8cb68c5cfc3778339ff74a8cfe.diff
LOG: [llvm-exegesis] Fix unused variable warning on non-linux platforms
Previous patches moved the save/restore system call register functions
behind a preprocessor check, but neglected to move the constant
expression array used by the functions behind the preprocessor check.
This patch gates the array behind the preprocessor check to fix build
failures caused by -Werror,unused-const-variable on the clang--ppc64-aix
buildbot.
Added:
Modified:
llvm/tools/llvm-exegesis/lib/X86/Target.cpp
Removed:
################################################################################
diff --git a/llvm/tools/llvm-exegesis/lib/X86/Target.cpp b/llvm/tools/llvm-exegesis/lib/X86/Target.cpp
index 4a9e4f52637876..4bca50911b48d3 100644
--- a/llvm/tools/llvm-exegesis/lib/X86/Target.cpp
+++ b/llvm/tools/llvm-exegesis/lib/X86/Target.cpp
@@ -926,12 +926,12 @@ void generateSyscall(long SyscallNumber, std::vector<MCInst> &GeneratedCode) {
GeneratedCode.push_back(MCInstBuilder(X86::SYSCALL));
}
-constexpr std::array<unsigned, 6> SyscallArgumentRegisters{
- X86::RDI, X86::RSI, X86::RDX, X86::R10, X86::R8, X86::R9};
-
// The functions below for saving and restoring system call registers are only
// used when llvm-exegesis is built on Linux.
#ifdef __linux__
+constexpr std::array<unsigned, 6> SyscallArgumentRegisters{
+ X86::RDI, X86::RSI, X86::RDX, X86::R10, X86::R8, X86::R9};
+
static void saveSyscallRegisters(std::vector<MCInst> &GeneratedCode,
unsigned ArgumentCount) {
assert(ArgumentCount <= 6 &&
More information about the llvm-commits
mailing list