mirror of
https://github.com/intel/llvm.git
synced 2026-02-05 13:21:04 +08:00
[clang] Remove no-op ptr-to-ptr bitcasts (NFC)
Opaque ptr cleanup effort (NFC).
This commit is contained in:
@@ -827,11 +827,8 @@ static void emitStructGetterCall(CodeGenFunction &CGF, ObjCIvarDecl *ivar,
|
||||
// sizeof (Type of Ivar), isAtomic, false);
|
||||
CallArgList args;
|
||||
|
||||
llvm::Value *dest =
|
||||
CGF.Builder.CreateBitCast(CGF.ReturnValue.getPointer(), CGF.VoidPtrTy);
|
||||
llvm::Value *dest = CGF.ReturnValue.getPointer();
|
||||
args.add(RValue::get(dest), Context.VoidPtrTy);
|
||||
|
||||
src = CGF.Builder.CreateBitCast(src, CGF.VoidPtrTy);
|
||||
args.add(RValue::get(src), Context.VoidPtrTy);
|
||||
|
||||
CharUnits size = CGF.getContext().getTypeSizeInChars(ivar->getType());
|
||||
@@ -1098,7 +1095,6 @@ static void emitCPPObjectAtomicGetterCall(CodeGenFunction &CGF,
|
||||
llvm::Value *ivarAddr =
|
||||
CGF.EmitLValueForIvar(CGF.TypeOfSelfObject(), CGF.LoadObjCSelf(), ivar, 0)
|
||||
.getPointer(CGF);
|
||||
ivarAddr = CGF.Builder.CreateBitCast(ivarAddr, CGF.Int8PtrTy);
|
||||
args.add(RValue::get(ivarAddr), CGF.getContext().VoidPtrTy);
|
||||
|
||||
// Third argument is the helper function.
|
||||
@@ -1340,7 +1336,6 @@ static void emitStructSetterCall(CodeGenFunction &CGF, ObjCMethodDecl *OMD,
|
||||
argVar->getType().getNonReferenceType(), VK_LValue,
|
||||
SourceLocation());
|
||||
llvm::Value *argAddr = CGF.EmitLValue(&argRef).getPointer(CGF);
|
||||
argAddr = CGF.Builder.CreateBitCast(argAddr, CGF.Int8PtrTy);
|
||||
args.add(RValue::get(argAddr), CGF.getContext().VoidPtrTy);
|
||||
|
||||
// The third argument is the sizeof the type.
|
||||
@@ -1377,7 +1372,6 @@ static void emitCPPObjectAtomicSetterCall(CodeGenFunction &CGF,
|
||||
llvm::Value *ivarAddr =
|
||||
CGF.EmitLValueForIvar(CGF.TypeOfSelfObject(), CGF.LoadObjCSelf(), ivar, 0)
|
||||
.getPointer(CGF);
|
||||
ivarAddr = CGF.Builder.CreateBitCast(ivarAddr, CGF.Int8PtrTy);
|
||||
args.add(RValue::get(ivarAddr), CGF.getContext().VoidPtrTy);
|
||||
|
||||
// The second argument is the address of the parameter variable.
|
||||
@@ -1386,7 +1380,6 @@ static void emitCPPObjectAtomicSetterCall(CodeGenFunction &CGF,
|
||||
argVar->getType().getNonReferenceType(), VK_LValue,
|
||||
SourceLocation());
|
||||
llvm::Value *argAddr = CGF.EmitLValue(&argRef).getPointer(CGF);
|
||||
argAddr = CGF.Builder.CreateBitCast(argAddr, CGF.Int8PtrTy);
|
||||
args.add(RValue::get(argAddr), CGF.getContext().VoidPtrTy);
|
||||
|
||||
// Third argument is the helper function.
|
||||
@@ -3685,7 +3678,6 @@ void CodeGenFunction::EmitExtendGCLifetime(llvm::Value *object) {
|
||||
/* constraints */ "r",
|
||||
/* side effects */ true);
|
||||
|
||||
object = Builder.CreateBitCast(object, VoidPtrTy);
|
||||
EmitNounwindRuntimeCall(extender, object);
|
||||
}
|
||||
|
||||
|
||||
@@ -2266,7 +2266,6 @@ MicrosoftCXXABI::performReturnAdjustment(CodeGenFunction &CGF, Address Ret,
|
||||
if (RA.isEmpty())
|
||||
return Ret.getPointer();
|
||||
|
||||
auto OrigTy = Ret.getType();
|
||||
Ret = Ret.withElementType(CGF.Int8Ty);
|
||||
|
||||
llvm::Value *V = Ret.getPointer();
|
||||
@@ -2283,8 +2282,7 @@ MicrosoftCXXABI::performReturnAdjustment(CodeGenFunction &CGF, Address Ret,
|
||||
if (RA.NonVirtual)
|
||||
V = CGF.Builder.CreateConstInBoundsGEP1_32(CGF.Int8Ty, V, RA.NonVirtual);
|
||||
|
||||
// Cast back to the original type.
|
||||
return CGF.Builder.CreateBitCast(V, OrigTy);
|
||||
return V;
|
||||
}
|
||||
|
||||
bool MicrosoftCXXABI::requiresArrayCookie(const CXXDeleteExpr *expr,
|
||||
|
||||
Reference in New Issue
Block a user