Add support for __block variables with alignment greater than __alignof(void *).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81602 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp
index c6d5b24..1141dd6 100644
--- a/lib/CodeGen/CGExpr.cpp
+++ b/lib/CodeGen/CGExpr.cpp
@@ -716,15 +716,10 @@
if (!NonGCable)
attr = getContext().getObjCGCAttrKind(E->getType());
if (VD->hasAttr<BlocksAttr>()) {
- bool needsCopyDispose = BlockRequiresCopying(VD->getType());
- const llvm::Type *PtrStructTy = V->getType();
- const llvm::Type *Ty = PtrStructTy;
- Ty = llvm::PointerType::get(Ty, 0);
V = Builder.CreateStructGEP(V, 1, "forwarding");
- V = Builder.CreateBitCast(V, Ty);
V = Builder.CreateLoad(V, false);
- V = Builder.CreateBitCast(V, PtrStructTy);
- V = Builder.CreateStructGEP(V, needsCopyDispose*2 + 4, "x");
+ V = Builder.CreateStructGEP(V, getByRefValueLLVMField(VD),
+ VD->getNameAsString());
}
if (VD->getType()->isReferenceType())
V = Builder.CreateLoad(V, "tmp");