aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGCXXExpr.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-11-13 21:20:14 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-11-13 21:20:14 +0000
commit6fb98d9172ebbb73e14db5e08ecc4361eccc76e1 (patch)
tree8f403ebca3300e4561c66b5ac585f6164ed5a6f6 /lib/CodeGen/CGCXXExpr.cpp
parent8db68da43086c4205b1df1c35a3778c0ea32b9cd (diff)
Fixes a code gen. bug for array delete operator call
int 32bit abi (pr5472 related). -This line, and those below, will be ignored-- M lib/CodeGen/CGCXXExpr.cpp git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88695 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGCXXExpr.cpp')
-rw-r--r--lib/CodeGen/CGCXXExpr.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/CodeGen/CGCXXExpr.cpp b/lib/CodeGen/CGCXXExpr.cpp
index d9275fc0a7..aa8acab4e6 100644
--- a/lib/CodeGen/CGCXXExpr.cpp
+++ b/lib/CodeGen/CGCXXExpr.cpp
@@ -284,12 +284,15 @@ void CodeGenFunction::EmitCXXDeleteExpr(const CXXDeleteExpr *E) {
llvm::Value *NumElementsPtr =
Builder.CreateConstInBoundsGEP1_64(AllocatedObjectPtr,
CookieOffset);
+ NumElementsPtr = Builder.CreateBitCast(NumElementsPtr,
+ ConvertType(SizeTy)->getPointerTo());
- NumElementsPtr =
- Builder.CreateBitCast(NumElementsPtr,
- llvm::Type::getInt64Ty(VMContext)->getPointerTo());
llvm::Value *NumElements =
Builder.CreateLoad(NumElementsPtr);
+ NumElements =
+ Builder.CreateIntCast(NumElements,
+ llvm::Type::getInt64Ty(VMContext), false,
+ "count.tmp");
assert (!Dtor->isVirtual() && "delete [] with virtual dtors NYI");
EmitCXXAggrDestructorCall(Dtor, NumElements, Ptr);
Ptr = AllocatedObjectPtr;