@@ -750,9 +750,9 @@ CGCallee ItaniumCXXABI::EmitLoadOfMemberFunctionPointer(
750750 } else {
751751 llvm::Value *VFPAddr =
752752 CGF.Builder .CreateGEP (CGF.Int8Ty , VTable, VTableOffset);
753- VirtualFn = CGF.Builder .CreateAlignedLoad (
754- llvm::PointerType::getUnqual ( CGF.getLLVMContext ()), VFPAddr ,
755- CGF. getPointerAlign (), " memptr.virtualfn" );
753+ VirtualFn = CGF.Builder .CreateAlignedLoad (CGF. UnqualPtrTy , VFPAddr,
754+ CGF.getPointerAlign () ,
755+ " memptr.virtualfn" );
756756 }
757757 }
758758 assert (VirtualFn && " Virtual fuction pointer not created!" );
@@ -792,9 +792,8 @@ CGCallee ItaniumCXXABI::EmitLoadOfMemberFunctionPointer(
792792 // In the non-virtual path, the function pointer is actually a
793793 // function pointer.
794794 CGF.EmitBlock (FnNonVirtual);
795- llvm::Value *NonVirtualFn = Builder.CreateIntToPtr (
796- FnAsInt, llvm::PointerType::getUnqual (CGF.getLLVMContext ()),
797- " memptr.nonvirtualfn" );
795+ llvm::Value *NonVirtualFn =
796+ Builder.CreateIntToPtr (FnAsInt, CGF.UnqualPtrTy , " memptr.nonvirtualfn" );
798797
799798 // Check the function pointer if CFI on member function pointers is enabled.
800799 if (ShouldEmitCFICheck) {
@@ -833,8 +832,7 @@ CGCallee ItaniumCXXABI::EmitLoadOfMemberFunctionPointer(
833832
834833 // We're done.
835834 CGF.EmitBlock (FnEnd);
836- llvm::PHINode *CalleePtr =
837- Builder.CreatePHI (llvm::PointerType::getUnqual (CGF.getLLVMContext ()), 2 );
835+ llvm::PHINode *CalleePtr = Builder.CreatePHI (CGF.UnqualPtrTy , 2 );
838836 CalleePtr->addIncoming (VirtualFn, FnVirtual);
839837 CalleePtr->addIncoming (NonVirtualFn, FnNonVirtual);
840838
@@ -1238,8 +1236,7 @@ void ItaniumCXXABI::emitVirtualObjectDelete(CodeGenFunction &CGF,
12381236 // Grab the vtable pointer as an intptr_t*.
12391237 auto *ClassDecl =
12401238 cast<CXXRecordDecl>(ElementType->castAs <RecordType>()->getDecl ());
1241- llvm::Value *VTable = CGF.GetVTablePtr (
1242- Ptr, llvm::PointerType::getUnqual (CGF.getLLVMContext ()), ClassDecl);
1239+ llvm::Value *VTable = CGF.GetVTablePtr (Ptr, CGF.UnqualPtrTy , ClassDecl);
12431240
12441241 // Track back to entry -2 and pull out the offset there.
12451242 llvm::Value *OffsetPtr = CGF.Builder .CreateConstInBoundsGEP1_64 (
@@ -1591,9 +1588,8 @@ llvm::Value *ItaniumCXXABI::emitDynamicCastToVoid(CodeGenFunction &CGF,
15911588 llvm::Value *OffsetToTop;
15921589 if (CGM.getItaniumVTableContext ().isRelativeLayout ()) {
15931590 // Get the vtable pointer.
1594- llvm::Value *VTable = CGF.GetVTablePtr (
1595- ThisAddr, llvm::PointerType::getUnqual (CGF.getLLVMContext ()),
1596- ClassDecl);
1591+ llvm::Value *VTable =
1592+ CGF.GetVTablePtr (ThisAddr, CGF.UnqualPtrTy , ClassDecl);
15971593
15981594 // Get the offset-to-top from the vtable.
15991595 OffsetToTop =
@@ -1605,9 +1601,8 @@ llvm::Value *ItaniumCXXABI::emitDynamicCastToVoid(CodeGenFunction &CGF,
16051601 CGF.ConvertType (CGF.getContext ().getPointerDiffType ());
16061602
16071603 // Get the vtable pointer.
1608- llvm::Value *VTable = CGF.GetVTablePtr (
1609- ThisAddr, llvm::PointerType::getUnqual (CGF.getLLVMContext ()),
1610- ClassDecl);
1604+ llvm::Value *VTable =
1605+ CGF.GetVTablePtr (ThisAddr, CGF.UnqualPtrTy , ClassDecl);
16111606
16121607 // Get the offset-to-top from the vtable.
16131608 OffsetToTop =
@@ -2308,8 +2303,8 @@ llvm::Value *ItaniumCXXABI::readArrayCookieImpl(CodeGenFunction &CGF,
23082303 // cookie, otherwise return 0 to avoid an infinite loop calling DTORs.
23092304 // We can't simply ignore this load using nosanitize metadata because
23102305 // the metadata may be lost.
2311- llvm::FunctionType *FTy = llvm::FunctionType::get (
2312- CGF. SizeTy , llvm::PointerType::getUnqual (CGF.getLLVMContext ()) , false );
2306+ llvm::FunctionType *FTy =
2307+ llvm::FunctionType::get (CGF.SizeTy , CGF. UnqualPtrTy , false );
23132308 llvm::FunctionCallee F =
23142309 CGM.CreateRuntimeFunction (FTy, " __asan_load_cxx_array_cookie" );
23152310 return CGF.Builder .CreateCall (F, numElementsPtr.getPointer ());
@@ -2652,7 +2647,7 @@ static void emitGlobalDtorWithCXAAtExit(CodeGenFunction &CGF,
26522647
26532648 // We're assuming that the destructor function is something we can
26542649 // reasonably call with the default CC.
2655- llvm::Type *dtorTy = llvm::PointerType::getUnqual ( CGF.getLLVMContext ()) ;
2650+ llvm::Type *dtorTy = CGF.UnqualPtrTy ;
26562651
26572652 // Preserve address space of addr.
26582653 auto AddrAS = addr ? addr->getType ()->getPointerAddressSpace () : 0 ;
@@ -4654,8 +4649,7 @@ static void InitCatchParam(CodeGenFunction &CGF,
46544649 auto catchRD = CatchType->getAsCXXRecordDecl ();
46554650 CharUnits caughtExnAlignment = CGF.CGM .getClassPointerAlignment (catchRD);
46564651
4657- llvm::Type *PtrTy =
4658- llvm::PointerType::getUnqual (CGF.getLLVMContext ()); // addrspace 0 ok
4652+ llvm::Type *PtrTy = CGF.UnqualPtrTy ; // addrspace 0 ok
46594653
46604654 // Check for a copy expression. If we don't have a copy expression,
46614655 // that means a trivial copy is okay.
@@ -4843,8 +4837,7 @@ void XLCXXABI::registerGlobalDtor(CodeGenFunction &CGF, const VarDecl &D,
48434837 llvm::FunctionCallee Dtor,
48444838 llvm::Constant *Addr) {
48454839 if (D.getTLSKind () != VarDecl::TLS_None) {
4846- llvm::PointerType *PtrTy =
4847- llvm::PointerType::getUnqual (CGF.getLLVMContext ());
4840+ llvm::PointerType *PtrTy = CGF.UnqualPtrTy ;
48484841
48494842 // extern "C" int __pt_atexit_np(int flags, int(*)(int,...), ...);
48504843 llvm::FunctionType *AtExitTy =
0 commit comments