[llvm] e8dfaff - [MemoryBuiltins] Remove some hardcoded builtins
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 9 02:29:03 PST 2022
Author: Nikita Popov
Date: 2022-12-09T11:28:51+01:00
New Revision: e8dfafff66b90847e37bd96491548caa6b80ab3f
URL: https://github.com/llvm/llvm-project/commit/e8dfafff66b90847e37bd96491548caa6b80ab3f
DIFF: https://github.com/llvm/llvm-project/commit/e8dfafff66b90847e37bd96491548caa6b80ab3f.diff
LOG: [MemoryBuiltins] Remove some hardcoded builtins
For all of these we already infer the new memory attributes, so
they don't need to be explicitly listed.
Added:
Modified:
llvm/lib/Analysis/MemoryBuiltins.cpp
llvm/test/Transforms/InstCombine/deref-alloc-fns.ll
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/MemoryBuiltins.cpp b/llvm/lib/Analysis/MemoryBuiltins.cpp
index 0945f30e96047..c251f924fdf48 100644
--- a/llvm/lib/Analysis/MemoryBuiltins.cpp
+++ b/llvm/lib/Analysis/MemoryBuiltins.cpp
@@ -115,7 +115,6 @@ struct AllocFnsTy {
// FIXME: certain users need more information. E.g., SimplifyLibCalls needs to
// know which functions are nounwind, noalias, nocapture parameters, etc.
static const std::pair<LibFunc, AllocFnsTy> AllocationFnData[] = {
- {LibFunc_vec_malloc, {MallocLike, 1, 0, -1, -1, MallocFamily::VecMalloc}},
{LibFunc_Znwj, {OpNewLike, 1, 0, -1, -1, MallocFamily::CPPNew}}, // new(unsigned int)
{LibFunc_ZnwjRKSt9nothrow_t, {MallocLike, 2, 0, -1, -1, MallocFamily::CPPNew}}, // new(unsigned int, nothrow)
{LibFunc_ZnwjSt11align_val_t, {OpNewLike, 2, 0, -1, 1, MallocFamily::CPPNewAligned}}, // new(unsigned int, align_val_t)
@@ -140,9 +139,6 @@ static const std::pair<LibFunc, AllocFnsTy> AllocationFnData[] = {
{LibFunc_msvc_new_array_int_nothrow, {MallocLike, 2, 0, -1, -1, MallocFamily::MSVCArrayNew}}, // new[](unsigned int, nothrow)
{LibFunc_msvc_new_array_longlong, {OpNewLike, 1, 0, -1, -1, MallocFamily::MSVCArrayNew}}, // new[](unsigned long long)
{LibFunc_msvc_new_array_longlong_nothrow, {MallocLike, 2, 0, -1, -1, MallocFamily::MSVCArrayNew}}, // new[](unsigned long long, nothrow)
- {LibFunc_memalign, {AlignedAllocLike, 2, 1, -1, 0, MallocFamily::Malloc}},
- {LibFunc_vec_calloc, {CallocLike, 2, 0, 1, -1, MallocFamily::VecMalloc}},
- {LibFunc_vec_realloc, {ReallocLike, 2, 1, -1, -1, MallocFamily::VecMalloc}},
{LibFunc_strdup, {StrDupLike, 1, -1, -1, -1, MallocFamily::Malloc}},
{LibFunc_dunder_strdup, {StrDupLike, 1, -1, -1, -1, MallocFamily::Malloc}},
{LibFunc_strndup, {StrDupLike, 2, 1, -1, -1, MallocFamily::Malloc}},
@@ -488,7 +484,6 @@ struct FreeFnsTy {
// clang-format off
static const std::pair<LibFunc, FreeFnsTy> FreeFnData[] = {
- {LibFunc_vec_free, {1, MallocFamily::VecMalloc}},
{LibFunc_ZdlPv, {1, MallocFamily::CPPNew}}, // operator delete(void*)
{LibFunc_ZdaPv, {1, MallocFamily::CPPNewArray}}, // operator delete[](void*)
{LibFunc_msvc_delete_ptr32, {1, MallocFamily::MSVCNew}}, // operator delete(void*)
diff --git a/llvm/test/Transforms/InstCombine/deref-alloc-fns.ll b/llvm/test/Transforms/InstCombine/deref-alloc-fns.ll
index 43edba1eacba9..80b25711122f5 100644
--- a/llvm/test/Transforms/InstCombine/deref-alloc-fns.ll
+++ b/llvm/test/Transforms/InstCombine/deref-alloc-fns.ll
@@ -10,7 +10,7 @@ declare noalias nonnull ptr @_Znam(i64) ; throwing version of 'new'
declare noalias nonnull ptr @_Znwm(i64) ; throwing version of 'new'
declare noalias ptr @strdup(ptr)
declare noalias ptr @aligned_alloc(i64 allocalign, i64) allockind("alloc,uninitialized,aligned") allocsize(1) "alloc-family"="malloc"
-declare noalias align 16 ptr @memalign(i64, i64)
+declare noalias align 16 ptr @memalign(i64 allocalign, i64) allocsize(1)
; new[](unsigned int, align_val_t)
declare noalias ptr @_ZnamSt11align_val_t(i64 %size, i64 %align)
More information about the llvm-commits
mailing list