[compiler-rt] r330190 - [sanitizer] Remove low-hanging-fruit dead code
Kostya Kortchinsky via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 17 07:54:50 PDT 2018
Author: cryptoad
Date: Tue Apr 17 07:54:50 2018
New Revision: 330190
URL: http://llvm.org/viewvc/llvm-project?rev=330190&view=rev
Log:
[sanitizer] Remove low-hanging-fruit dead code
Summary:
Going through the dead code findings, the code removed in this CL appears to be
pretty straightforward to remove, and seems to be some leftover from previous
refactors.
Reviewers: alekseyshl, eugenis
Reviewed By: alekseyshl
Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D45704
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_internal.h
compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_nolibc.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.h
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_internal.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_internal.h?rev=330190&r1=330189&r2=330190&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_internal.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_allocator_internal.h Tue Apr 17 07:54:50 2018
@@ -62,15 +62,6 @@ void *InternalCalloc(uptr countr, uptr s
void InternalFree(void *p, InternalAllocatorCache *cache = nullptr);
InternalAllocator *internal_allocator();
-enum InternalAllocEnum {
- INTERNAL_ALLOC
-};
-
} // namespace __sanitizer
-inline void *operator new(__sanitizer::operator_new_size_type size,
- __sanitizer::InternalAllocEnum) {
- return __sanitizer::InternalAlloc(size);
-}
-
#endif // SANITIZER_ALLOCATOR_INTERNAL_H
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_nolibc.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_nolibc.cc?rev=330190&r1=330189&r2=330190&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_nolibc.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_nolibc.cc Tue Apr 17 07:54:50 2018
@@ -21,7 +21,6 @@ namespace __sanitizer {
// bypassing libc.
#if !SANITIZER_WINDOWS
#if SANITIZER_LINUX
-bool ShouldLogAfterPrintf() { return false; }
void LogMessageOnPrintf(const char *str) {}
#endif
void WriteToSyslog(const char *buffer) {}
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.cc?rev=330190&r1=330189&r2=330190&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_flags.cc Tue Apr 17 07:54:50 2018
@@ -22,14 +22,6 @@ namespace __sanitizer {
CommonFlags common_flags_dont_use;
-struct FlagDescription {
- const char *name;
- const char *description;
- FlagDescription *next;
-};
-
-IntrusiveList<FlagDescription> flag_descriptions;
-
void CommonFlags::SetDefaults() {
#define COMMON_FLAG(Type, Name, DefaultValue, Description) Name = DefaultValue;
#include "sanitizer_flags.inc"
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.cc?rev=330190&r1=330189&r2=330190&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.cc Tue Apr 17 07:54:50 2018
@@ -72,17 +72,6 @@ void *internal_memmove(void *dest, const
return dest;
}
-// Semi-fast bzero for 16-aligned data. Still far from peak performance.
-void internal_bzero_aligned16(void *s, uptr n) {
- struct ALIGNED(16) S16 { u64 a, b; };
- CHECK_EQ((reinterpret_cast<uptr>(s) | n) & 15, 0);
- for (S16 *p = reinterpret_cast<S16*>(s), *end = p + n / 16; p < end; p++) {
- p->a = p->b = 0;
- // Make sure this does not become memset.
- SanitizerBreakOptimization(nullptr);
- }
-}
-
void *internal_memset(void* s, int c, uptr n) {
// The next line prevents Clang from making a call to memset() instead of the
// loop below.
@@ -112,14 +101,6 @@ char* internal_strdup(const char *s) {
return s2;
}
-char* internal_strndup(const char *s, uptr n) {
- uptr len = internal_strnlen(s, n);
- char *s2 = (char*)InternalAlloc(len + 1);
- internal_memcpy(s2, s, len);
- s2[len] = 0;
- return s2;
-}
-
int internal_strcmp(const char *s1, const char *s2) {
while (true) {
unsigned c1 = *s1;
@@ -234,12 +215,6 @@ char *internal_strstr(const char *haysta
return nullptr;
}
-uptr internal_wcslen(const wchar_t *s) {
- uptr i = 0;
- while (s[i]) i++;
- return i;
-}
-
s64 internal_simple_strtoll(const char *nptr, char **endptr, int base) {
CHECK_EQ(base, 10);
while (IsSpace(*nptr)) nptr++;
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.h?rev=330190&r1=330189&r2=330190&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.h Tue Apr 17 07:54:50 2018
@@ -32,8 +32,6 @@ void *internal_memrchr(const void *s, in
int internal_memcmp(const void* s1, const void* s2, uptr n);
void *internal_memcpy(void *dest, const void *src, uptr n);
void *internal_memmove(void *dest, const void *src, uptr n);
-// Set [s, s + n) to 0. Both s and n should be 16-aligned.
-void internal_bzero_aligned16(void *s, uptr n);
// Should not be used in performance-critical places.
void *internal_memset(void *s, int c, uptr n);
char* internal_strchr(const char *s, int c);
@@ -41,7 +39,6 @@ char *internal_strchrnul(const char *s,
int internal_strcmp(const char *s1, const char *s2);
uptr internal_strcspn(const char *s, const char *reject);
char *internal_strdup(const char *s);
-char *internal_strndup(const char *s, uptr n);
uptr internal_strlen(const char *s);
uptr internal_strlcat(char *dst, const char *src, uptr maxlen);
char *internal_strncat(char *dst, const char *src, uptr n);
@@ -50,8 +47,6 @@ uptr internal_strlcpy(char *dst, const c
char *internal_strncpy(char *dst, const char *src, uptr n);
uptr internal_strnlen(const char *s, uptr maxlen);
char *internal_strrchr(const char *s, int c);
-// This is O(N^2), but we are not using it in hot places.
-uptr internal_wcslen(const wchar_t *s);
char *internal_strstr(const char *haystack, const char *needle);
// Works only for base=10 and doesn't set errno.
s64 internal_simple_strtoll(const char *nptr, char **endptr, int base);
More information about the llvm-commits
mailing list