mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-25 16:24:23 +00:00
Treat nothrow forms of ::operator delete and ::operator delete[] as
deallocation functions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186798 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -24,8 +24,12 @@ namespace llvm {
|
|||||||
under_IO_putc,
|
under_IO_putc,
|
||||||
/// void operator delete[](void*);
|
/// void operator delete[](void*);
|
||||||
ZdaPv,
|
ZdaPv,
|
||||||
|
/// void operator delete[](void*, nothrow);
|
||||||
|
ZdaPvRKSt9nothrow_t,
|
||||||
/// void operator delete(void*);
|
/// void operator delete(void*);
|
||||||
ZdlPv,
|
ZdlPv,
|
||||||
|
/// void operator delete(void*, nothrow);
|
||||||
|
ZdlPvRKSt9nothrow_t,
|
||||||
/// void *new[](unsigned int);
|
/// void *new[](unsigned int);
|
||||||
Znaj,
|
Znaj,
|
||||||
/// void *new[](unsigned int, nothrow);
|
/// void *new[](unsigned int, nothrow);
|
||||||
|
@ -318,9 +318,15 @@ const CallInst *llvm::isFreeCall(const Value *I, const TargetLibraryInfo *TLI) {
|
|||||||
if (!TLI || !TLI->getLibFunc(FnName, TLIFn) || !TLI->has(TLIFn))
|
if (!TLI || !TLI->getLibFunc(FnName, TLIFn) || !TLI->has(TLIFn))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (TLIFn != LibFunc::free &&
|
unsigned ExpectedNumParams;
|
||||||
TLIFn != LibFunc::ZdlPv && // operator delete(void*)
|
if (TLIFn == LibFunc::free ||
|
||||||
TLIFn != LibFunc::ZdaPv) // operator delete[](void*)
|
TLIFn == LibFunc::ZdlPv || // operator delete(void*)
|
||||||
|
TLIFn == LibFunc::ZdaPv) // operator delete[](void*)
|
||||||
|
ExpectedNumParams = 1;
|
||||||
|
else if (TLIFn == LibFunc::ZdlPvRKSt9nothrow_t || // delete(void*, nothrow)
|
||||||
|
TLIFn == LibFunc::ZdaPvRKSt9nothrow_t) // delete[](void*, nothrow)
|
||||||
|
ExpectedNumParams = 2;
|
||||||
|
else
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// Check free prototype.
|
// Check free prototype.
|
||||||
@ -329,7 +335,7 @@ const CallInst *llvm::isFreeCall(const Value *I, const TargetLibraryInfo *TLI) {
|
|||||||
FunctionType *FTy = Callee->getFunctionType();
|
FunctionType *FTy = Callee->getFunctionType();
|
||||||
if (!FTy->getReturnType()->isVoidTy())
|
if (!FTy->getReturnType()->isVoidTy())
|
||||||
return 0;
|
return 0;
|
||||||
if (FTy->getNumParams() != 1)
|
if (FTy->getNumParams() != ExpectedNumParams)
|
||||||
return 0;
|
return 0;
|
||||||
if (FTy->getParamType(0) != Type::getInt8PtrTy(Callee->getContext()))
|
if (FTy->getParamType(0) != Type::getInt8PtrTy(Callee->getContext()))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -27,7 +27,9 @@ const char* TargetLibraryInfo::StandardNames[LibFunc::NumLibFuncs] =
|
|||||||
"_IO_getc",
|
"_IO_getc",
|
||||||
"_IO_putc",
|
"_IO_putc",
|
||||||
"_ZdaPv",
|
"_ZdaPv",
|
||||||
|
"_ZdaPvRKSt9nothrow_t",
|
||||||
"_ZdlPv",
|
"_ZdlPv",
|
||||||
|
"_ZdlPvRKSt9nothrow_t",
|
||||||
"_Znaj",
|
"_Znaj",
|
||||||
"_ZnajRKSt9nothrow_t",
|
"_ZnajRKSt9nothrow_t",
|
||||||
"_Znam",
|
"_Znam",
|
||||||
|
@ -120,3 +120,27 @@ if.then: ; preds = %entry
|
|||||||
if.end: ; preds = %entry, %if.then
|
if.end: ; preds = %entry, %if.then
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
declare i8* @_ZnwmRKSt9nothrow_t(i64, i8*) nobuiltin
|
||||||
|
declare void @_ZdlPvRKSt9nothrow_t(i8*, i8*) nobuiltin
|
||||||
|
declare i32 @__gxx_personality_v0(...)
|
||||||
|
declare void @_ZN1AC2Ev(i8* %this)
|
||||||
|
|
||||||
|
; CHECK-LABEL: @test7(
|
||||||
|
define void @test7() {
|
||||||
|
entry:
|
||||||
|
%nt = alloca i8
|
||||||
|
; CHECK-NOT: call {{.*}}@_ZnwmRKSt9nothrow_t(
|
||||||
|
%call.i = tail call i8* @_ZnwmRKSt9nothrow_t(i64 1, i8* %nt) builtin nounwind
|
||||||
|
invoke void @_ZN1AC2Ev(i8* undef)
|
||||||
|
to label %.noexc.i unwind label %lpad.i
|
||||||
|
|
||||||
|
.noexc.i: ; preds = %entry
|
||||||
|
unreachable
|
||||||
|
|
||||||
|
lpad.i: ; preds = %entry
|
||||||
|
%0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) cleanup
|
||||||
|
; CHECK-NOT: call {{.*}}@_ZdlPvRKSt9nothrow_t(
|
||||||
|
call void @_ZdlPvRKSt9nothrow_t(i8* %call.i, i8* %nt) builtin nounwind
|
||||||
|
resume { i8*, i32 } %0
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user