@@ -1262,8 +1262,6 @@ void MicrosoftCXXABI::initializeHiddenVirtualInheritanceMembers(
1262
1262
Builder.CreateInBoundsGEP (CGF.Int8Ty , Int8This, VBaseOffset);
1263
1263
// vtorDisp is always the 32-bits before the vbase in the class layout.
1264
1264
VtorDispPtr = Builder.CreateConstGEP1_32 (CGF.Int8Ty , VtorDispPtr, -4 );
1265
- VtorDispPtr = Builder.CreateBitCast (
1266
- VtorDispPtr, CGF.Int32Ty ->getPointerTo (AS), " vtordisp.ptr" );
1267
1265
1268
1266
Builder.CreateAlignedStore (VtorDispValue, VtorDispPtr,
1269
1267
CharUnits::fromQuantity (4 ));
@@ -1568,14 +1566,9 @@ void MicrosoftCXXABI::EmitInstanceFunctionProlog(CodeGenFunction &CGF) {
1568
1566
if (!CGF.CurFuncIsThunk && MD->isVirtual ()) {
1569
1567
CharUnits Adjustment = getVirtualFunctionPrologueThisAdjustment (CGF.CurGD );
1570
1568
if (!Adjustment.isZero ()) {
1571
- unsigned AS = cast<llvm::PointerType>(This->getType ())->getAddressSpace ();
1572
- llvm::Type *charPtrTy = CGF.Int8Ty ->getPointerTo (AS),
1573
- *thisTy = This->getType ();
1574
- This = CGF.Builder .CreateBitCast (This, charPtrTy);
1575
1569
assert (Adjustment.isPositive ());
1576
1570
This = CGF.Builder .CreateConstInBoundsGEP1_32 (CGF.Int8Ty , This,
1577
1571
-Adjustment.getQuantity ());
1578
- This = CGF.Builder .CreateBitCast (This, thisTy, " this.adjusted" );
1579
1572
}
1580
1573
}
1581
1574
setCXXABIThisValue (CGF, This);
@@ -2511,9 +2504,6 @@ LValue MicrosoftCXXABI::EmitThreadLocalVarDeclLValue(CodeGenFunction &CGF,
2511
2504
llvm::Value *V = CGF.CGM .GetAddrOfGlobalVar (VD);
2512
2505
llvm::Type *RealVarTy = CGF.getTypes ().ConvertTypeForMem (VD->getType ());
2513
2506
2514
- unsigned AS = cast<llvm::PointerType>(V->getType ())->getAddressSpace ();
2515
- V = CGF.Builder .CreateBitCast (V, RealVarTy->getPointerTo (AS));
2516
-
2517
2507
CharUnits Alignment = CGF.getContext ().getDeclAlign (VD);
2518
2508
Address Addr (V, RealVarTy, Alignment);
2519
2509
@@ -3226,9 +3216,6 @@ llvm::Value *MicrosoftCXXABI::EmitMemberDataPointerAddress(
3226
3216
CodeGenFunction &CGF, const Expr *E, Address Base, llvm::Value *MemPtr,
3227
3217
const MemberPointerType *MPT) {
3228
3218
assert (MPT->isMemberDataPointer ());
3229
- unsigned AS = Base.getAddressSpace ();
3230
- llvm::Type *PType =
3231
- CGF.ConvertTypeForMem (MPT->getPointeeType ())->getPointerTo (AS);
3232
3219
CGBuilderTy &Builder = CGF.Builder ;
3233
3220
const CXXRecordDecl *RD = MPT->getMostRecentCXXRecordDecl ();
3234
3221
MSInheritanceModel Inheritance = RD->getMSInheritanceModel ();
@@ -3256,16 +3243,9 @@ llvm::Value *MicrosoftCXXABI::EmitMemberDataPointerAddress(
3256
3243
Addr = Base.getPointer ();
3257
3244
}
3258
3245
3259
- // Cast to char*.
3260
- Addr = Builder.CreateBitCast (Addr, CGF.Int8Ty ->getPointerTo (AS));
3261
-
3262
3246
// Apply the offset, which we assume is non-null.
3263
- Addr = Builder.CreateInBoundsGEP (CGF.Int8Ty , Addr, FieldOffset,
3247
+ return Builder.CreateInBoundsGEP (CGF.Int8Ty , Addr, FieldOffset,
3264
3248
" memptr.offset" );
3265
-
3266
- // Cast the address to the appropriate pointer type, adopting the address
3267
- // space of the base pointer.
3268
- return Builder.CreateBitCast (Addr, PType);
3269
3249
}
3270
3250
3271
3251
llvm::Value *
0 commit comments