diff --git a/llvm/lib/Analysis/MemoryBuiltins.cpp b/llvm/lib/Analysis/MemoryBuiltins.cpp --- a/llvm/lib/Analysis/MemoryBuiltins.cpp +++ b/llvm/lib/Analysis/MemoryBuiltins.cpp @@ -144,9 +144,7 @@ // FIXME: certain users need more information. E.g., SimplifyLibCalls needs to // know which functions are nounwind, noalias, nocapture parameters, etc. static const std::pair AllocationFnData[] = { - {LibFunc_malloc, {MallocLike, 1, 0, -1, -1, MallocFamily::Malloc}}, {LibFunc_vec_malloc, {MallocLike, 1, 0, -1, -1, MallocFamily::VecMalloc}}, - {LibFunc_valloc, {MallocLike, 1, 0, -1, -1, MallocFamily::Malloc}}, {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) @@ -171,13 +169,9 @@ {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_aligned_alloc, {AlignedAllocLike, 2, 1, -1, 0, MallocFamily::Malloc}}, {LibFunc_memalign, {AlignedAllocLike, 2, 1, -1, 0, MallocFamily::Malloc}}, - {LibFunc_calloc, {CallocLike, 2, 0, 1, -1, MallocFamily::Malloc}}, {LibFunc_vec_calloc, {CallocLike, 2, 0, 1, -1, MallocFamily::VecMalloc}}, - {LibFunc_realloc, {ReallocLike, 2, 1, -1, -1, MallocFamily::Malloc}}, {LibFunc_vec_realloc, {ReallocLike, 2, 1, -1, -1, MallocFamily::VecMalloc}}, - {LibFunc_reallocf, {ReallocLike, 2, 1, -1, -1, MallocFamily::Malloc}}, {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}}, @@ -530,7 +524,6 @@ // clang-format off static const std::pair FreeFnData[] = { - {LibFunc_free, {1, MallocFamily::Malloc}}, {LibFunc_vec_free, {1, MallocFamily::VecMalloc}}, {LibFunc_ZdlPv, {1, MallocFamily::CPPNew}}, // operator delete(void*) {LibFunc_ZdaPv, {1, MallocFamily::CPPNewArray}}, // operator delete[](void*) diff --git a/llvm/test/Transforms/Attributor/heap_to_stack.ll b/llvm/test/Transforms/Attributor/heap_to_stack.ll --- a/llvm/test/Transforms/Attributor/heap_to_stack.ll +++ b/llvm/test/Transforms/Attributor/heap_to_stack.ll @@ -187,7 +187,7 @@ ; ; IS________NPM-LABEL: define {{[^@]+}}@test3b ; IS________NPM-SAME: (i8* nocapture [[P:%.*]]) { -; IS________NPM-NEXT: [[DOTH2S:%.*]] = alloca i8, i64 128, align 32 +; IS________NPM-NEXT: [[DOTH2S:%.*]] = alloca i8, i64 128, align 1 ; IS________NPM-NEXT: tail call void @nofree_arg_only(i8* noalias nocapture nofree [[DOTH2S]], i8* nocapture [[P]]) ; IS________NPM-NEXT: ret void ; @@ -199,16 +199,10 @@ ; leave alone non-constant alignments. define void @test3c(i64 %alignment) { -; IS________OPM-LABEL: define {{[^@]+}}@test3c -; IS________OPM-SAME: (i64 [[ALIGNMENT:%.*]]) { -; IS________OPM-NEXT: [[DOTH2S:%.*]] = alloca i8, i64 128, align 1 -; IS________OPM-NEXT: ret void -; -; IS________NPM-LABEL: define {{[^@]+}}@test3c -; IS________NPM-SAME: (i64 [[ALIGNMENT:%.*]]) { -; IS________NPM-NEXT: [[TMP1:%.*]] = tail call noalias i8* @aligned_alloc(i64 [[ALIGNMENT]], i64 noundef 128) -; IS________NPM-NEXT: tail call void @free(i8* noalias nocapture [[TMP1]]) -; IS________NPM-NEXT: ret void +; CHECK-LABEL: define {{[^@]+}}@test3c +; CHECK-SAME: (i64 [[ALIGNMENT:%.*]]) { +; CHECK-NEXT: [[DOTH2S:%.*]] = alloca i8, i64 128, align 1 +; CHECK-NEXT: ret void ; %1 = tail call noalias i8* @aligned_alloc(i64 %alignment, i64 128) tail call void @free(i8* %1) @@ -225,9 +219,8 @@ ; ; IS________NPM-LABEL: define {{[^@]+}}@test3d ; IS________NPM-SAME: (i8* nocapture [[P:%.*]]) { -; IS________NPM-NEXT: [[TMP1:%.*]] = tail call noalias i8* @aligned_alloc(i64 noundef 33, i64 noundef 128) -; IS________NPM-NEXT: tail call void @nofree_arg_only(i8* noalias nocapture nofree [[TMP1]], i8* nocapture [[P]]) -; IS________NPM-NEXT: tail call void @free(i8* noalias nocapture [[TMP1]]) +; IS________NPM-NEXT: [[DOTH2S:%.*]] = alloca i8, i64 128, align 1 +; IS________NPM-NEXT: tail call void @nofree_arg_only(i8* noalias nocapture nofree [[DOTH2S]], i8* nocapture [[P]]) ; IS________NPM-NEXT: ret void ; ; CHECK-SAME; (i8* nocapture [[P:%.*]]) {