[clang] 09f1aac - [CGBlocks] Remove no-op ptr-to-ptr bitcasts (NFC)
Youngsuk Kim via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 1 13:03:38 PDT 2023
Author: Youngsuk Kim
Date: 2023-11-01T15:01:55-05:00
New Revision: 09f1aaca0bdc260c29043188aa2f63bcbe07f02f
URL: https://github.com/llvm/llvm-project/commit/09f1aaca0bdc260c29043188aa2f63bcbe07f02f
DIFF: https://github.com/llvm/llvm-project/commit/09f1aaca0bdc260c29043188aa2f63bcbe07f02f.diff
LOG: [CGBlocks] Remove no-op ptr-to-ptr bitcasts (NFC)
Opaque ptr cleanup effort. NFC.
Added:
Modified:
clang/lib/CodeGen/CGBlocks.cpp
Removed:
################################################################################
diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp
index 27f525ee35edbf9..dbc4cffa8976d6f 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.
More information about the cfe-commits
mailing list