diff options
author | Aiden Grossman <aidengrossman@google.com> | 2024-08-27 11:19:44 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-27 11:19:44 -0700 |
commit | fac87b889c50f493ba332950f613fa15a45be9a9 (patch) | |
tree | ed2649576e64af1612b47391667fcae345b30f02 /llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp | |
parent | c349ded7e61f3611ea54fa712e54b16c4c317a6b (diff) | |
download | llvm-fac87b889c50f493ba332950f613fa15a45be9a9.zip llvm-fac87b889c50f493ba332950f613fa15a45be9a9.tar.gz llvm-fac87b889c50f493ba332950f613fa15a45be9a9.tar.bz2 |
[llvm-exegesis] Switch from intptr_t to uintptr_t in most cases (#102860)
This patch switches most of the uses of intptr_t to uintptr_t within
llvm-exegesis for the subprocess memory support. In the vast majority of
cases we do not want a signed component of the address, hence making
intptr_t undesirable. intptr_t is left for error handling, for example
when making syscalls and we need to see if the syscall returned -1.
Diffstat (limited to 'llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp')
-rw-r--r-- | llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp index adee869..fd98af8 100644 --- a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp +++ b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp @@ -379,7 +379,7 @@ private: if (ChildSignalInfo.si_signo == SIGSEGV) return make_error<SnippetSegmentationFault>( - reinterpret_cast<intptr_t>(ChildSignalInfo.si_addr)); + reinterpret_cast<uintptr_t>(ChildSignalInfo.si_addr)); return make_error<SnippetSignal>(ChildSignalInfo.si_signo); } @@ -477,9 +477,10 @@ private: if (__rseq_size < 32) RseqStructSize = 32; - long RseqDisableOutput = - syscall(SYS_rseq, (intptr_t)__builtin_thread_pointer() + __rseq_offset, - RseqStructSize, RSEQ_FLAG_UNREGISTER, RSEQ_SIG); + long RseqDisableOutput = syscall( + SYS_rseq, + reinterpret_cast<uintptr_t>(__builtin_thread_pointer()) + __rseq_offset, + RseqStructSize, RSEQ_FLAG_UNREGISTER, RSEQ_SIG); if (RseqDisableOutput != 0) exit(ChildProcessExitCodeE::RSeqDisableFailed); #endif // GLIBC_INITS_RSEQ @@ -502,7 +503,7 @@ private: char *FunctionDataCopy = (char *)mmap(MapAddress, FunctionDataCopySize, PROT_READ | PROT_WRITE, MapFlags, 0, 0); - if ((intptr_t)FunctionDataCopy == -1) + if (reinterpret_cast<intptr_t>(FunctionDataCopy) == -1) exit(ChildProcessExitCodeE::FunctionDataMappingFailed); memcpy(FunctionDataCopy, this->Function.FunctionBytes.data(), @@ -515,8 +516,8 @@ private: if (!AuxMemFDOrError) exit(ChildProcessExitCodeE::AuxiliaryMemorySetupFailed); - ((void (*)(size_t, int))(intptr_t)FunctionDataCopy)(FunctionDataCopySize, - *AuxMemFDOrError); + ((void (*)(size_t, int))(uintptr_t)FunctionDataCopy)(FunctionDataCopySize, + *AuxMemFDOrError); exit(0); } |