diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp index 27f525ee35edb..dbc4cffa8976d 100644 --- a/clang/lib/CodeGen/CGBlocks.cpp +++ b/clang/lib/CodeGen/CGBlocks.cpp @@ -203,8 +203,7 @@ static llvm::Constant *buildBlockDescriptor(CodeGenModule &CGM, // Signature. Mandatory ObjC-style method descriptor @encode sequence. std::string typeAtEncoding = CGM.getContext().getObjCEncodingForBlock(blockInfo.getBlockExpr()); - elements.add(llvm::ConstantExpr::getBitCast( - CGM.GetAddrOfConstantCString(typeAtEncoding).getPointer(), i8p)); + elements.add(CGM.GetAddrOfConstantCString(typeAtEncoding).getPointer()); // GC layout. if (C.getLangOpts().ObjC) { @@ -809,7 +808,7 @@ llvm::Value *CodeGenFunction::EmitBlockLiteral(const CGBlockInfo &blockInfo) { llvm::Constant *blockISA = blockInfo.NoEscape ? CGM.getNSConcreteGlobalBlock() : CGM.getNSConcreteStackBlock(); - isa = llvm::ConstantExpr::getBitCast(blockISA, VoidPtrTy); + isa = blockISA; // Build the block descriptor. descriptor = buildBlockDescriptor(CGM, blockInfo); @@ -1869,7 +1868,7 @@ CodeGenFunction::GenerateCopyHelperFunction(const CGBlockInfo &blockInfo) { CaptureStrKind::CopyHelper, CGM); if (llvm::GlobalValue *Func = CGM.getModule().getNamedValue(FuncName)) - return llvm::ConstantExpr::getBitCast(Func, VoidPtrTy); + return Func; ASTContext &C = getContext(); @@ -1990,7 +1989,7 @@ CodeGenFunction::GenerateCopyHelperFunction(const CGBlockInfo &blockInfo) { FinishFunction(); - return llvm::ConstantExpr::getBitCast(Fn, VoidPtrTy); + return Fn; } static BlockFieldFlags @@ -2056,7 +2055,7 @@ CodeGenFunction::GenerateDestroyHelperFunction(const CGBlockInfo &blockInfo) { CaptureStrKind::DisposeHelper, CGM); if (llvm::GlobalValue *Func = CGM.getModule().getNamedValue(FuncName)) - return llvm::ConstantExpr::getBitCast(Func, VoidPtrTy); + return Func; ASTContext &C = getContext(); @@ -2113,7 +2112,7 @@ CodeGenFunction::GenerateDestroyHelperFunction(const CGBlockInfo &blockInfo) { FinishFunction(); - return llvm::ConstantExpr::getBitCast(Fn, VoidPtrTy); + return Fn; } namespace { @@ -2352,7 +2351,7 @@ generateByrefCopyHelper(CodeGenFunction &CGF, const BlockByrefInfo &byrefInfo, CGF.FinishFunction(); - return llvm::ConstantExpr::getBitCast(Fn, CGF.Int8PtrTy); + return Fn; } /// Build the copy helper for a __block variable. @@ -2408,7 +2407,7 @@ generateByrefDisposeHelper(CodeGenFunction &CGF, CGF.FinishFunction(); - return llvm::ConstantExpr::getBitCast(Fn, CGF.Int8PtrTy); + return Fn; } /// Build the dispose helper for a __block variable.