forked from OSchip/llvm-project
[instcombine] Add align return attributes for operator new(..., align_val)
(Split from original patch to separate non-NFC part and add coverage. I typoed when adding the new test, so this change includes the typo fix to let libfunc recongize the signature. Didn't figure it was worth another separate commit.) Differential Revision: https://reviews.llvm.org/D116851 (part 2 of 2)
This commit is contained in:
parent
fb936595fa
commit
7febd60a90
|
@ -78,20 +78,20 @@ static const std::pair<LibFunc, AllocFnsTy> AllocationFnData[] = {
|
|||
{LibFunc_valloc, {MallocLike, 1, 0, -1, -1}},
|
||||
{LibFunc_Znwj, {OpNewLike, 1, 0, -1, -1}}, // new(unsigned int)
|
||||
{LibFunc_ZnwjRKSt9nothrow_t, {MallocLike, 2, 0, -1, -1}}, // new(unsigned int, nothrow)
|
||||
{LibFunc_ZnwjSt11align_val_t, {OpNewLike, 2, 0, -1, -1}}, // new(unsigned int, align_val_t)
|
||||
{LibFunc_ZnwjSt11align_val_tRKSt9nothrow_t, {MallocLike, 3, 0, -1, -1}}, // new(unsigned int, align_val_t, nothrow)
|
||||
{LibFunc_ZnwjSt11align_val_t, {OpNewLike, 2, 0, -1, 1}}, // new(unsigned int, align_val_t)
|
||||
{LibFunc_ZnwjSt11align_val_tRKSt9nothrow_t, {MallocLike, 3, 0, -1, 1}}, // new(unsigned int, align_val_t, nothrow)
|
||||
{LibFunc_Znwm, {OpNewLike, 1, 0, -1, -1}}, // new(unsigned long)
|
||||
{LibFunc_ZnwmRKSt9nothrow_t, {MallocLike, 2, 0, -1, -1}}, // new(unsigned long, nothrow)
|
||||
{LibFunc_ZnwmSt11align_val_t, {OpNewLike, 2, 0, -1, -1}}, // new(unsigned long, align_val_t)
|
||||
{LibFunc_ZnwmSt11align_val_tRKSt9nothrow_t, {MallocLike, 3, 0, -1, -1}}, // new(unsigned long, align_val_t, nothrow)
|
||||
{LibFunc_ZnwmSt11align_val_t, {OpNewLike, 2, 0, -1, 1}}, // new(unsigned long, align_val_t)
|
||||
{LibFunc_ZnwmSt11align_val_tRKSt9nothrow_t, {MallocLike, 3, 0, -1, 1}}, // new(unsigned long, align_val_t, nothrow)
|
||||
{LibFunc_Znaj, {OpNewLike, 1, 0, -1, -1}}, // new[](unsigned int)
|
||||
{LibFunc_ZnajRKSt9nothrow_t, {MallocLike, 2, 0, -1, -1}}, // new[](unsigned int, nothrow)
|
||||
{LibFunc_ZnajSt11align_val_t, {OpNewLike, 2, 0, -1, -1}}, // new[](unsigned int, align_val_t)
|
||||
{LibFunc_ZnajSt11align_val_tRKSt9nothrow_t, {MallocLike, 3, 0, -1, -1}}, // new[](unsigned int, align_val_t, nothrow)
|
||||
{LibFunc_ZnajSt11align_val_t, {OpNewLike, 2, 0, -1, 1}}, // new[](unsigned int, align_val_t)
|
||||
{LibFunc_ZnajSt11align_val_tRKSt9nothrow_t, {MallocLike, 3, 0, -1, 1}}, // new[](unsigned int, align_val_t, nothrow)
|
||||
{LibFunc_Znam, {OpNewLike, 1, 0, -1, -1}}, // new[](unsigned long)
|
||||
{LibFunc_ZnamRKSt9nothrow_t, {MallocLike, 2, 0, -1, -1}}, // new[](unsigned long, nothrow)
|
||||
{LibFunc_ZnamSt11align_val_t, {OpNewLike, 2, 0, -1, -1}}, // new[](unsigned long, align_val_t)
|
||||
{LibFunc_ZnamSt11align_val_tRKSt9nothrow_t, {MallocLike, 3, 0, -1, -1}}, // new[](unsigned long, align_val_t, nothrow)
|
||||
{LibFunc_ZnamSt11align_val_t, {OpNewLike, 2, 0, -1, 1}}, // new[](unsigned long, align_val_t)
|
||||
{LibFunc_ZnamSt11align_val_tRKSt9nothrow_t, {MallocLike, 3, 0, -1, 1}}, // new[](unsigned long, align_val_t, nothrow)
|
||||
{LibFunc_msvc_new_int, {OpNewLike, 1, 0, -1, -1}}, // new(unsigned int)
|
||||
{LibFunc_msvc_new_int_nothrow, {MallocLike, 2, 0, -1, -1}}, // new(unsigned int, nothrow)
|
||||
{LibFunc_msvc_new_longlong, {OpNewLike, 1, 0, -1, -1}}, // new(unsigned long long)
|
||||
|
|
|
@ -12,7 +12,7 @@ declare noalias i8* @strdup(i8*)
|
|||
declare noalias i8* @aligned_alloc(i64, i64)
|
||||
declare noalias align 16 i8* @memalign(i64, i64)
|
||||
; new[](unsigned int, align_val_t)
|
||||
declare noalias i8* @_ZnajSt11align_val_t(i65 %size, i64 %align)
|
||||
declare noalias i8* @_ZnajSt11align_val_t(i64 %size, i64 %align)
|
||||
|
||||
@.str = private unnamed_addr constant [6 x i8] c"hello\00", align 1
|
||||
|
||||
|
@ -347,10 +347,10 @@ bb:
|
|||
|
||||
define noalias i8* @op_new_align() {
|
||||
; CHECK-LABEL: @op_new_align(
|
||||
; CHECK-NEXT: [[CALL:%.*]] = tail call i8* @_ZnajSt11align_val_t(i65 32, i64 32)
|
||||
; CHECK-NEXT: [[CALL:%.*]] = tail call align 32 dereferenceable_or_null(32) i8* @_ZnajSt11align_val_t(i64 32, i64 32)
|
||||
; CHECK-NEXT: ret i8* [[CALL]]
|
||||
;
|
||||
%call = tail call i8* @_ZnajSt11align_val_t(i65 32, i64 32)
|
||||
%call = tail call i8* @_ZnajSt11align_val_t(i64 32, i64 32)
|
||||
ret i8* %call
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue