Skip to content

Commit 09f1aac

Browse files
committed
[CGBlocks] Remove no-op ptr-to-ptr bitcasts (NFC)
Opaque ptr cleanup effort. NFC.
1 parent 6266b96 commit 09f1aac

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

clang/lib/CodeGen/CGBlocks.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,7 @@ static llvm::Constant *buildBlockDescriptor(CodeGenModule &CGM,
203203
// Signature. Mandatory ObjC-style method descriptor @encode sequence.
204204
std::string typeAtEncoding =
205205
CGM.getContext().getObjCEncodingForBlock(blockInfo.getBlockExpr());
206-
elements.add(llvm::ConstantExpr::getBitCast(
207-
CGM.GetAddrOfConstantCString(typeAtEncoding).getPointer(), i8p));
206+
elements.add(CGM.GetAddrOfConstantCString(typeAtEncoding).getPointer());
208207

209208
// GC layout.
210209
if (C.getLangOpts().ObjC) {
@@ -809,7 +808,7 @@ llvm::Value *CodeGenFunction::EmitBlockLiteral(const CGBlockInfo &blockInfo) {
809808
llvm::Constant *blockISA = blockInfo.NoEscape
810809
? CGM.getNSConcreteGlobalBlock()
811810
: CGM.getNSConcreteStackBlock();
812-
isa = llvm::ConstantExpr::getBitCast(blockISA, VoidPtrTy);
811+
isa = blockISA;
813812

814813
// Build the block descriptor.
815814
descriptor = buildBlockDescriptor(CGM, blockInfo);
@@ -1869,7 +1868,7 @@ CodeGenFunction::GenerateCopyHelperFunction(const CGBlockInfo &blockInfo) {
18691868
CaptureStrKind::CopyHelper, CGM);
18701869

18711870
if (llvm::GlobalValue *Func = CGM.getModule().getNamedValue(FuncName))
1872-
return llvm::ConstantExpr::getBitCast(Func, VoidPtrTy);
1871+
return Func;
18731872

18741873
ASTContext &C = getContext();
18751874

@@ -1990,7 +1989,7 @@ CodeGenFunction::GenerateCopyHelperFunction(const CGBlockInfo &blockInfo) {
19901989

19911990
FinishFunction();
19921991

1993-
return llvm::ConstantExpr::getBitCast(Fn, VoidPtrTy);
1992+
return Fn;
19941993
}
19951994

19961995
static BlockFieldFlags
@@ -2056,7 +2055,7 @@ CodeGenFunction::GenerateDestroyHelperFunction(const CGBlockInfo &blockInfo) {
20562055
CaptureStrKind::DisposeHelper, CGM);
20572056

20582057
if (llvm::GlobalValue *Func = CGM.getModule().getNamedValue(FuncName))
2059-
return llvm::ConstantExpr::getBitCast(Func, VoidPtrTy);
2058+
return Func;
20602059

20612060
ASTContext &C = getContext();
20622061

@@ -2113,7 +2112,7 @@ CodeGenFunction::GenerateDestroyHelperFunction(const CGBlockInfo &blockInfo) {
21132112

21142113
FinishFunction();
21152114

2116-
return llvm::ConstantExpr::getBitCast(Fn, VoidPtrTy);
2115+
return Fn;
21172116
}
21182117

21192118
namespace {
@@ -2352,7 +2351,7 @@ generateByrefCopyHelper(CodeGenFunction &CGF, const BlockByrefInfo &byrefInfo,
23522351

23532352
CGF.FinishFunction();
23542353

2355-
return llvm::ConstantExpr::getBitCast(Fn, CGF.Int8PtrTy);
2354+
return Fn;
23562355
}
23572356

23582357
/// Build the copy helper for a __block variable.
@@ -2408,7 +2407,7 @@ generateByrefDisposeHelper(CodeGenFunction &CGF,
24082407

24092408
CGF.FinishFunction();
24102409

2411-
return llvm::ConstantExpr::getBitCast(Fn, CGF.Int8PtrTy);
2410+
return Fn;
24122411
}
24132412

24142413
/// Build the dispose helper for a __block variable.

0 commit comments

Comments
 (0)