diff --git a/clang/lib/CodeGen/Address.h b/clang/lib/CodeGen/Address.h --- a/clang/lib/CodeGen/Address.h +++ b/clang/lib/CodeGen/Address.h @@ -131,9 +131,7 @@ } ConstantAddress getElementBitCast(llvm::Type *ElemTy) const { - llvm::Constant *BitCast = llvm::ConstantExpr::getBitCast( - getPointer(), ElemTy->getPointerTo(getAddressSpace())); - return ConstantAddress(BitCast, ElemTy, getAlignment()); + return ConstantAddress(getPointer(), ElemTy, getAlignment()); } static bool isaImpl(Address addr) { diff --git a/clang/lib/CodeGen/CGAtomic.cpp b/clang/lib/CodeGen/CGAtomic.cpp --- a/clang/lib/CodeGen/CGAtomic.cpp +++ b/clang/lib/CodeGen/CGAtomic.cpp @@ -88,7 +88,7 @@ CGF.Int8Ty, VoidPtrAddr, OffsetInChars.getQuantity()); llvm::Type *IntTy = CGF.Builder.getIntNTy(AtomicSizeInBits); auto Addr = CGF.Builder.CreatePointerBitCastOrAddrSpaceCast( - VoidPtrAddr, IntTy->getPointerTo(), "atomic_bitfield_base"); + VoidPtrAddr, llvm::PointerType::getUnqual(IntTy), "atomic_bitfield_base"); BFI = OrigBFI; BFI.Offset = Offset; BFI.StorageSize = AtomicSizeInBits; @@ -796,8 +796,7 @@ ValTy = CGF.getContext().getIntTypeForBitwidth(SizeInBits, /*Signed=*/false); llvm::Type *ITy = llvm::IntegerType::get(CGF.getLLVMContext(), SizeInBits); - Address Ptr = Address(CGF.Builder.CreateBitCast(Val, ITy->getPointerTo()), - ITy, Align); + Address Ptr = Address(Val, ITy, Align); Val = CGF.EmitLoadOfScalar(Ptr, false, CGF.getContext().getPointerType(ValTy), Loc); diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp --- a/clang/lib/CodeGen/CGBlocks.cpp +++ b/clang/lib/CodeGen/CGBlocks.cpp @@ -1427,7 +1427,8 @@ // directly as BlockPointer. BlockPointer = Builder.CreatePointerCast( arg, - BlockInfo->StructureType->getPointerTo( + llvm::PointerType::get( + BlockInfo->StructureType, getContext().getLangOpts().OpenCL ? getContext().getTargetAddressSpace(LangAS::opencl_generic) : 0), diff --git a/clang/lib/CodeGen/CGBuilder.h b/clang/lib/CodeGen/CGBuilder.h --- a/clang/lib/CodeGen/CGBuilder.h +++ b/clang/lib/CodeGen/CGBuilder.h @@ -168,7 +168,7 @@ /// preserving information like the alignment and address space. Address CreateElementBitCast(Address Addr, llvm::Type *Ty, const llvm::Twine &Name = "") { - auto *PtrTy = Ty->getPointerTo(Addr.getAddressSpace()); + auto *PtrTy = llvm::PointerType::get(Ty, Addr.getAddressSpace()); return Address(CreateBitCast(Addr.getPointer(), PtrTy, Name), Ty, Addr.getAlignment(), Addr.isKnownNonNull()); } diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -219,7 +219,7 @@ llvm::IntegerType *IntType = llvm::IntegerType::get(CGF.getLLVMContext(), CGF.getContext().getTypeSize(T)); - llvm::Type *IntPtrType = IntType->getPointerTo(AddrSpace); + llvm::Type *IntPtrType = llvm::PointerType::get(IntType, AddrSpace); llvm::Value *Args[2]; Args[0] = CGF.Builder.CreateBitCast(DestPtr, IntPtrType); @@ -281,7 +281,7 @@ llvm::IntegerType *IntType = llvm::IntegerType::get(CGF.getLLVMContext(), CGF.getContext().getTypeSize(T)); - llvm::Type *IntPtrType = IntType->getPointerTo(AddrSpace); + llvm::Type *IntPtrType = llvm::PointerType::get(IntType, AddrSpace); llvm::Value *Args[2]; Args[1] = CGF.EmitScalarExpr(E->getArg(1)); @@ -322,7 +322,7 @@ llvm::IntegerType *IntType = llvm::IntegerType::get( CGF.getLLVMContext(), CGF.getContext().getTypeSize(T)); - llvm::Type *IntPtrType = IntType->getPointerTo(AddrSpace); + llvm::Type *IntPtrType = llvm::PointerType::get(IntType, AddrSpace); Value *Args[3]; Args[0] = CGF.Builder.CreateBitCast(DestPtr, IntPtrType); @@ -417,7 +417,7 @@ // Convert to i128 pointers and values. llvm::Type *Int128Ty = llvm::IntegerType::get(CGF.getLLVMContext(), 128); - llvm::Type *Int128PtrTy = Int128Ty->getPointerTo(); + llvm::Type *Int128PtrTy = llvm::PointerType::getUnqual(Int128Ty); Destination = CGF.Builder.CreateBitCast(Destination, Int128PtrTy); Address ComparandResult(CGF.Builder.CreateBitCast(ComparandPtr, Int128PtrTy), Int128Ty, CGF.getContext().toCharUnitsFromBits(128)); @@ -483,7 +483,6 @@ CharUnits LoadSize = CGF.getContext().getTypeSizeInChars(ElTy); llvm::Type *ITy = llvm::IntegerType::get(CGF.getLLVMContext(), LoadSize.getQuantity() * 8); - Ptr = CGF.Builder.CreateBitCast(Ptr, ITy->getPointerTo()); llvm::LoadInst *Load = CGF.Builder.CreateAlignedLoad(ITy, Ptr, LoadSize); Load->setVolatile(true); return Load; @@ -495,9 +494,6 @@ Value *Value = CGF.EmitScalarExpr(E->getArg(1)); QualType ElTy = E->getArg(0)->getType()->getPointeeType(); CharUnits StoreSize = CGF.getContext().getTypeSizeInChars(ElTy); - llvm::Type *ITy = - llvm::IntegerType::get(CGF.getLLVMContext(), StoreSize.getQuantity() * 8); - Ptr = CGF.Builder.CreateBitCast(Ptr, ITy->getPointerTo()); llvm::StoreInst *Store = CGF.Builder.CreateAlignedStore(Value, Ptr, StoreSize); Store->setVolatile(true); @@ -982,7 +978,7 @@ llvm::IntegerType *IntType = llvm::IntegerType::get( CGF.getLLVMContext(), CGF.getContext().getTypeSize(E->getArg(1)->getType())); - llvm::Type *IntPtrType = IntType->getPointerTo(); + llvm::Type *IntPtrType = llvm::PointerType::getUnqual(IntType); llvm::FunctionType *FTy = llvm::FunctionType::get(CGF.Int8Ty, {IntPtrType, IntType}, false); @@ -1123,7 +1119,7 @@ Constraints += MachineClobbers; } - llvm::Type *IntPtrType = RetType->getPointerTo(); + llvm::Type *IntPtrType = llvm::PointerType::getUnqual(RetType); llvm::FunctionType *FTy = llvm::FunctionType::get(RetType, {IntPtrType}, false); @@ -4092,7 +4088,6 @@ CharUnits StoreSize = getContext().getTypeSizeInChars(ElTy); llvm::Type *ITy = llvm::IntegerType::get(getLLVMContext(), StoreSize.getQuantity() * 8); - Ptr = Builder.CreateBitCast(Ptr, ITy->getPointerTo()); llvm::StoreInst *Store = Builder.CreateAlignedStore(llvm::Constant::getNullValue(ITy), Ptr, StoreSize); @@ -4147,8 +4142,6 @@ PtrTy->castAs()->getPointeeType().isVolatileQualified(); Value *Ptr = EmitScalarExpr(E->getArg(0)); - unsigned AddrSpace = Ptr->getType()->getPointerAddressSpace(); - Ptr = Builder.CreateBitCast(Ptr, Int8Ty->getPointerTo(AddrSpace)); Value *NewVal = Builder.getInt8(1); Value *Order = EmitScalarExpr(E->getArg(1)); if (isa(Order)) { @@ -4669,7 +4662,7 @@ llvm::IntegerType *IntType = IntegerType::get(getLLVMContext(), getContext().getTypeSize(E->getType())); - llvm::Type *IntPtrType = IntType->getPointerTo(); + llvm::Type *IntPtrType = llvm::PointerType::getUnqual(IntType); llvm::Value *Destination = Builder.CreateBitCast(EmitScalarExpr(E->getArg(0)), IntPtrType); @@ -5119,8 +5112,8 @@ // Any calls now have event arguments passed. if (NumArgs >= 7) { llvm::Type *EventTy = ConvertType(getContext().OCLClkEventTy); - llvm::PointerType *EventPtrTy = EventTy->getPointerTo( - CGM.getContext().getTargetAddressSpace(LangAS::opencl_generic)); + llvm::PointerType *EventPtrTy = + llvm::PointerType::get(EventTy, CGM.getContext().getTargetAddressSpace(LangAS::opencl_generic)); llvm::Value *NumEvents = Builder.CreateZExtOrTrunc(EmitScalarExpr(E->getArg(3)), Int32Ty); @@ -5476,7 +5469,7 @@ ArgValue->getType()->getPointerAddressSpace()) { ArgValue = Builder.CreateAddrSpaceCast( ArgValue, - ArgValue->getType()->getPointerTo(PtrTy->getAddressSpace())); + llvm::PointerType::get(ArgValue->getType(), PtrTy->getAddressSpace())); } } @@ -5506,7 +5499,7 @@ if (auto *PtrTy = dyn_cast(RetTy)) { if (PtrTy->getAddressSpace() != V->getType()->getPointerAddressSpace()) { V = Builder.CreateAddrSpaceCast( - V, V->getType()->getPointerTo(PtrTy->getAddressSpace())); + V, llvm::PointerType::get(V->getType(), PtrTy->getAddressSpace())); } } @@ -8039,8 +8032,7 @@ llvm::Type *RealResTy = ConvertType(Ty); llvm::Type *IntTy = llvm::IntegerType::get(getLLVMContext(), getContext().getTypeSize(Ty)); - llvm::Type *PtrTy = IntTy->getPointerTo(); - LoadAddr = Builder.CreateBitCast(LoadAddr, PtrTy); + llvm::Type *PtrTy = llvm::PointerType::getUnqual(IntTy); Function *F = CGM.getIntrinsic( BuiltinID == clang::ARM::BI__builtin_arm_ldaex ? Intrinsic::arm_ldaex @@ -8090,7 +8082,6 @@ QualType Ty = E->getArg(0)->getType(); llvm::Type *StoreTy = llvm::IntegerType::get(getLLVMContext(), getContext().getTypeSize(Ty)); - StoreAddr = Builder.CreateBitCast(StoreAddr, StoreTy->getPointerTo()); if (StoreVal->getType()->isPointerTy()) StoreVal = Builder.CreatePtrToInt(StoreVal, Int32Ty); @@ -9366,12 +9357,9 @@ // Implement the index operand if not omitted. if (Ops.size() > 3) { - BasePtr = Builder.CreateBitCast(BasePtr, MemoryTy->getPointerTo()); BasePtr = Builder.CreateGEP(MemoryTy, BasePtr, Ops[2]); } - // Prefetch intriniscs always expect an i8* - BasePtr = Builder.CreateBitCast(BasePtr, llvm::PointerType::getUnqual(Int8Ty)); Value *PrfOp = Ops.back(); Function *F = CGM.getIntrinsic(BuiltinID, Predicate->getType()); @@ -9393,13 +9381,12 @@ auto MemoryTy = llvm::ScalableVectorType::get(MemEltTy, VectorTy); Value *Predicate = EmitSVEPredicateCast(Ops[0], MemoryTy); - Value *BasePtr = Builder.CreateBitCast(Ops[1], MemoryTy->getPointerTo()); + Value *BasePtr = Ops[1]; // Does the load have an offset? if (Ops.size() > 2) BasePtr = Builder.CreateGEP(MemoryTy, BasePtr, Ops[2]); - BasePtr = Builder.CreateBitCast(BasePtr, MemEltTy->getPointerTo()); Function *F = CGM.getIntrinsic(BuiltinID, MemoryTy); auto *Load = cast(Builder.CreateCall(F, {Predicate, BasePtr})); @@ -9423,7 +9410,7 @@ auto MemoryTy = llvm::ScalableVectorType::get(MemEltTy, VectorTy); Value *Predicate = EmitSVEPredicateCast(Ops[0], MemoryTy); - Value *BasePtr = Builder.CreateBitCast(Ops[1], MemoryTy->getPointerTo()); + Value *BasePtr = Ops[1]; // Does the store have an offset? if (Ops.size() == 4) @@ -9432,7 +9419,6 @@ // Last value is always the data llvm::Value *Val = Builder.CreateTrunc(Ops.back(), MemoryTy); - BasePtr = Builder.CreateBitCast(BasePtr, MemEltTy->getPointerTo()); Function *F = CGM.getIntrinsic(BuiltinID, MemoryTy); auto *Store = cast(Builder.CreateCall(F, {Val, Predicate, BasePtr})); @@ -10152,8 +10138,7 @@ llvm::Type *RealResTy = ConvertType(Ty); llvm::Type *IntTy = llvm::IntegerType::get(getLLVMContext(), getContext().getTypeSize(Ty)); - llvm::Type *PtrTy = IntTy->getPointerTo(); - LoadAddr = Builder.CreateBitCast(LoadAddr, PtrTy); + llvm::Type *PtrTy = llvm::PointerType::getUnqual(IntTy); Function *F = CGM.getIntrinsic(BuiltinID == clang::AArch64::BI__builtin_arm_ldaex @@ -10203,7 +10188,6 @@ QualType Ty = E->getArg(0)->getType(); llvm::Type *StoreTy = llvm::IntegerType::get(getLLVMContext(), getContext().getTypeSize(Ty)); - StoreAddr = Builder.CreateBitCast(StoreAddr, StoreTy->getPointerTo()); if (StoreVal->getType()->isPointerTy()) StoreVal = Builder.CreatePtrToInt(StoreVal, Int64Ty); @@ -15971,9 +15955,8 @@ // If the user wants the entire vector, just load the entire vector. if (NumBytes == 16) { - Value *BC = Builder.CreateBitCast(Op0, ResTy->getPointerTo()); Value *LD = - Builder.CreateLoad(Address(BC, ResTy, CharUnits::fromQuantity(1))); + Builder.CreateLoad(Address(Op0, ResTy, CharUnits::fromQuantity(1))); if (!IsLE) return LD; @@ -16026,7 +16009,6 @@ // Storing the whole vector, simply store it on BE and reverse bytes and // store on LE. if (Width == 16) { - Value *BC = Builder.CreateBitCast(Op0, Op2->getType()->getPointerTo()); Value *StVec = Op2; if (IsLE) { SmallVector RevMask; @@ -16035,7 +16017,7 @@ StVec = Builder.CreateShuffleVector(Op2, Op2, RevMask); } return Builder.CreateStore( - StVec, Address(BC, Op2->getType(), CharUnits::fromQuantity(1))); + StVec, Address(Op0, Op2->getType(), CharUnits::fromQuantity(1))); } auto *ConvTy = Int64Ty; unsigned NumElts = 0; @@ -16063,14 +16045,13 @@ Op2, llvm::FixedVectorType::get(ConvTy, NumElts)); Value *Ptr = Builder.CreateGEP(Int8Ty, Op0, ConstantInt::get(Int64Ty, Offset)); - Value *PtrBC = Builder.CreateBitCast(Ptr, ConvTy->getPointerTo()); Value *Elt = Builder.CreateExtractElement(Vec, EltNo); if (IsLE && Width > 1) { Function *F = CGM.getIntrinsic(Intrinsic::bswap, ConvTy); Elt = Builder.CreateCall(F, Elt); } return Builder.CreateStore( - Elt, Address(PtrBC, ConvTy, CharUnits::fromQuantity(1))); + Elt, Address(Ptr, ConvTy, CharUnits::fromQuantity(1))); }; unsigned Stored = 0; unsigned RemainingBytes = NumBytes; @@ -16718,7 +16699,7 @@ Value *Vec = Builder.CreateLoad(Addr); Value *Call = Builder.CreateCall(F, {Vec}); llvm::Type *VTy = llvm::FixedVectorType::get(Int8Ty, 16); - Value *Ptr = Builder.CreateBitCast(Ops[0], VTy->getPointerTo()); + Value *Ptr = Ops[0]; for (unsigned i=0; igetPointerTo(GEP->getType()->getPointerAddressSpace()); + llvm::PointerType::get(CGF.Int16Ty, GEP->getType()->getPointerAddressSpace()); auto *Cast = CGF.Builder.CreateBitCast(GEP, DstTy); auto *LD = CGF.Builder.CreateLoad( Address(Cast, CGF.Int16Ty, CharUnits::fromQuantity(2))); @@ -17035,7 +17016,7 @@ auto *Offset = llvm::ConstantInt::get(CGF.Int32Ty, XOffset + Index * 4); auto *GEP = CGF.Builder.CreateGEP(CGF.Int8Ty, DP, Offset); auto *DstTy = - CGF.Int32Ty->getPointerTo(GEP->getType()->getPointerAddressSpace()); + llvm::PointerType::get(CGF.Int32Ty, GEP->getType()->getPointerAddressSpace()); auto *Cast = CGF.Builder.CreateBitCast(GEP, DstTy); auto *LD = CGF.Builder.CreateLoad( Address(Cast, CGF.Int32Ty, CharUnits::fromQuantity(4))); @@ -19846,8 +19827,7 @@ // generate one (NewBase). The new base address needs to be stored. llvm::Value *NewBase = IsLoad ? Builder.CreateExtractValue(Result, 1) : Result; - llvm::Value *LV = Builder.CreateBitCast( - EmitScalarExpr(E->getArg(0)), NewBase->getType()->getPointerTo()); + llvm::Value *LV = EmitScalarExpr(E->getArg(0)); Address Dest = EmitPointerWithAlignment(E->getArg(0)); llvm::Value *RetVal = Builder.CreateAlignedStore(NewBase, LV, Dest.getAlignment()); @@ -19888,9 +19868,7 @@ // to be handled with stores of respective destination type. DestVal = Builder.CreateTrunc(DestVal, DestTy); - llvm::Value *DestForStore = - Builder.CreateBitCast(DestAddress, DestVal->getType()->getPointerTo()); - Builder.CreateAlignedStore(DestVal, DestForStore, DestAddr.getAlignment()); + Builder.CreateAlignedStore(DestVal, DestAddress, DestAddr.getAlignment()); // The updated value of the base pointer is returned. return Builder.CreateExtractValue(Result, 1); }; diff --git a/clang/lib/CodeGen/CGCUDANV.cpp b/clang/lib/CodeGen/CGCUDANV.cpp --- a/clang/lib/CodeGen/CGCUDANV.cpp +++ b/clang/lib/CodeGen/CGCUDANV.cpp @@ -237,7 +237,7 @@ CharPtrTy = llvm::PointerType::getUnqual(Types.ConvertType(Ctx.CharTy)); VoidPtrTy = cast(Types.ConvertType(Ctx.VoidPtrTy)); - VoidPtrPtrTy = VoidPtrTy->getPointerTo(); + VoidPtrPtrTy = llvm::PointerType::getUnqual(VoidPtrTy); } llvm::FunctionCallee CGNVCUDARuntime::getSetupArgumentFn() const { @@ -270,8 +270,8 @@ llvm::FunctionType *CGNVCUDARuntime::getRegisterLinkedBinaryFnTy() const { auto *CallbackFnTy = getCallbackFnTy(); auto *RegisterGlobalsFnTy = getRegisterGlobalsFnTy(); - llvm::Type *Params[] = {RegisterGlobalsFnTy->getPointerTo(), VoidPtrTy, - VoidPtrTy, CallbackFnTy->getPointerTo()}; + llvm::Type *Params[] = {llvm::PointerType::getUnqual(RegisterGlobalsFnTy), VoidPtrTy, + VoidPtrTy, llvm::PointerType::getUnqual(CallbackFnTy)}; return llvm::FunctionType::get(VoidTy, Params, false); } @@ -538,7 +538,7 @@ // int, uint3*, uint3*, dim3*, dim3*, int*) llvm::Type *RegisterFuncParams[] = { VoidPtrPtrTy, CharPtrTy, CharPtrTy, CharPtrTy, IntTy, - VoidPtrTy, VoidPtrTy, VoidPtrTy, VoidPtrTy, IntTy->getPointerTo()}; + VoidPtrTy, VoidPtrTy, VoidPtrTy, VoidPtrTy, llvm::PointerType::getUnqual(IntTy)}; llvm::FunctionCallee RegisterFunc = CGM.CreateRuntimeFunction( llvm::FunctionType::get(IntTy, RegisterFuncParams, false), addUnderscoredPrefixToName("RegisterFunction")); @@ -561,7 +561,7 @@ NullPtr, NullPtr, NullPtr, - llvm::ConstantPointerNull::get(IntTy->getPointerTo())}; + llvm::ConstantPointerNull::get(llvm::PointerType::getUnqual(IntTy))}; Builder.CreateCall(RegisterFunc, Args); } diff --git a/clang/lib/CodeGen/CGCXX.cpp b/clang/lib/CodeGen/CGCXX.cpp --- a/clang/lib/CodeGen/CGCXX.cpp +++ b/clang/lib/CodeGen/CGCXX.cpp @@ -133,7 +133,7 @@ // Derive the type for the alias. llvm::Type *AliasValueType = getTypes().GetFunctionType(AliasDecl); - llvm::PointerType *AliasType = AliasValueType->getPointerTo(); + llvm::PointerType *AliasType = llvm::PointerType::getUnqual(AliasValueType); // Find the referent. Some aliases might require a bitcast, in // which case the caller is responsible for ensuring the soundness @@ -252,8 +252,7 @@ "No kext in Microsoft ABI"); CodeGenModule &CGM = CGF.CGM; llvm::Value *VTable = CGM.getCXXABI().getAddrOfVTable(RD, CharUnits()); - Ty = Ty->getPointerTo(); - VTable = CGF.Builder.CreateBitCast(VTable, Ty->getPointerTo()); + Ty = llvm::PointerType::getUnqual(Ty); assert(VTable && "BuildVirtualCall = kext vtbl pointer is null"); uint64_t VTableIndex = CGM.getItaniumVTableContext().getMethodVTableIndex(GD); const VTableLayout &VTLayout = CGM.getItaniumVTableContext().getVTableLayout(RD); diff --git a/clang/lib/CodeGen/CGCXXABI.cpp b/clang/lib/CodeGen/CGCXXABI.cpp --- a/clang/lib/CodeGen/CGCXXABI.cpp +++ b/clang/lib/CodeGen/CGCXXABI.cpp @@ -50,7 +50,7 @@ cast(MPT->getClass()->castAs()->getDecl()); llvm::FunctionType *FTy = CGM.getTypes().GetFunctionType( CGM.getTypes().arrangeCXXMethodType(RD, FPT, /*FD=*/nullptr)); - llvm::Constant *FnPtr = llvm::Constant::getNullValue(FTy->getPointerTo()); + llvm::Constant *FnPtr = llvm::Constant::getNullValue(llvm::PointerType::getUnqual(FTy)); return CGCallee::forDirect(FnPtr, FPT); } @@ -59,8 +59,9 @@ Address Base, llvm::Value *MemPtr, const MemberPointerType *MPT) { ErrorUnsupportedABI(CGF, "loads of member pointers"); - llvm::Type *Ty = CGF.ConvertType(MPT->getPointeeType()) - ->getPointerTo(Base.getAddressSpace()); + llvm::Type *Ty = + llvm::PointerType::get(CGF.ConvertType(MPT->getPointeeType()), + Base.getAddressSpace()); return llvm::Constant::getNullValue(Ty); } diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp --- a/clang/lib/CodeGen/CGClass.cpp +++ b/clang/lib/CodeGen/CGClass.cpp @@ -272,8 +272,6 @@ // Apply the base offset. llvm::Value *ptr = addr.getPointer(); - unsigned AddrSpace = ptr->getType()->getPointerAddressSpace(); - ptr = CGF.Builder.CreateBitCast(ptr, CGF.Int8Ty->getPointerTo(AddrSpace)); ptr = CGF.Builder.CreateInBoundsGEP(CGF.Int8Ty, ptr, baseOffset, "add.ptr"); // If we have a virtual component, the alignment of the result will @@ -330,7 +328,7 @@ // Get the base pointer type. llvm::Type *BaseValueTy = ConvertType((PathEnd[-1])->getType()); llvm::Type *BasePtrTy = - BaseValueTy->getPointerTo(Value.getType()->getPointerAddressSpace()); + llvm::PointerType::get(BaseValueTy, Value.getType()->getPointerAddressSpace()); QualType DerivedTy = getContext().getRecordType(Derived); CharUnits DerivedAlign = CGM.getClassPointerAlignment(Derived); @@ -410,7 +408,7 @@ getContext().getCanonicalType(getContext().getTagDeclType(Derived)); unsigned AddrSpace = BaseAddr.getAddressSpace(); llvm::Type *DerivedValueTy = ConvertType(DerivedTy); - llvm::Type *DerivedPtrTy = DerivedValueTy->getPointerTo(AddrSpace); + llvm::Type *DerivedPtrTy = llvm::PointerType::get(DerivedValueTy, AddrSpace); llvm::Value *NonVirtualOffset = CGM.GetNonVirtualBaseClassOffset(Derived, PathBegin, PathEnd); @@ -2581,9 +2579,11 @@ unsigned GlobalsAS = CGM.getDataLayout().getDefaultGlobalsAddressSpace(); unsigned ProgAS = CGM.getDataLayout().getProgramAddressSpace(); llvm::Type *VTablePtrTy = - llvm::FunctionType::get(CGM.Int32Ty, /*isVarArg=*/true) - ->getPointerTo(ProgAS) - ->getPointerTo(GlobalsAS); + llvm::PointerType::get( + llvm::PointerType::get( + llvm::FunctionType::get(CGM.Int32Ty, /*isVarArg=*/true), + ProgAS), + GlobalsAS); // vtable field is derived from `this` pointer, therefore they should be in // the same addr space. Note that this might not be LLVM address space 0. VTableField = Builder.CreateElementBitCast(VTableField, VTablePtrTy); diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp --- a/clang/lib/CodeGen/CGDecl.cpp +++ b/clang/lib/CodeGen/CGDecl.cpp @@ -292,7 +292,7 @@ if (AS != ExpectedAS) { Addr = getTargetCodeGenInfo().performAddrSpaceCast( *this, GV, AS, ExpectedAS, - LTy->getPointerTo(getContext().getTargetAddressSpace(ExpectedAS))); + llvm::PointerType::get(LTy, getContext().getTargetAddressSpace(ExpectedAS))); } setStaticLocalDeclAddress(&D, Addr); @@ -2513,7 +2513,7 @@ assert(getContext().getTargetAddressSpace(SrcLangAS) == CGM.getDataLayout().getAllocaAddrSpace()); auto DestAS = getContext().getTargetAddressSpace(DestLangAS); - auto *T = DeclPtr.getElementType()->getPointerTo(DestAS); + auto *T = llvm::PointerType::get(DeclPtr.getElementType(), DestAS); DeclPtr = DeclPtr.withPointer(getTargetHooks().performAddrSpaceCast( *this, V, SrcLangAS, DestLangAS, T, true), diff --git a/clang/lib/CodeGen/CGDeclCXX.cpp b/clang/lib/CodeGen/CGDeclCXX.cpp --- a/clang/lib/CodeGen/CGDeclCXX.cpp +++ b/clang/lib/CodeGen/CGDeclCXX.cpp @@ -122,7 +122,8 @@ if (CGF.getContext().getLangOpts().OpenCL) { auto DestAS = CGM.getTargetCodeGenInfo().getAddrSpaceOfCxaAtexitPtrParam(); - auto DestTy = CGF.getTypes().ConvertType(Type)->getPointerTo( + auto DestTy = llvm::PointerType::get( + CGF.getTypes().ConvertType(Type), CGM.getContext().getTargetAddressSpace(DestAS)); auto SrcAS = D.getType().getQualifiers().getAddressSpace(); if (DestAS == SrcAS) @@ -132,8 +133,7 @@ // of the global destructor function should be adjusted accordingly. Argument = llvm::ConstantPointerNull::get(DestTy); } else { - Argument = llvm::ConstantExpr::getBitCast( - Addr.getPointer(), CGF.getTypes().ConvertType(Type)->getPointerTo()); + Argument = Addr.getPointer(); } // Otherwise, the standard logic requires a helper function. } else { diff --git a/clang/lib/CodeGen/CGException.cpp b/clang/lib/CodeGen/CGException.cpp --- a/clang/lib/CodeGen/CGException.cpp +++ b/clang/lib/CodeGen/CGException.cpp @@ -2101,7 +2101,6 @@ // pointer is stored in the second field. So, GEP 20 bytes backwards and // load the pointer. SEHInfo = Builder.CreateConstInBoundsGEP1_32(Int8Ty, EntryFP, -20); - SEHInfo = Builder.CreateBitCast(SEHInfo, Int8PtrTy->getPointerTo()); SEHInfo = Builder.CreateAlignedLoad(Int8PtrTy, SEHInfo, getPointerAlign()); SEHCodeSlotStack.push_back(recoverAddrOfEscapedLocal( ParentCGF, ParentCGF.SEHCodeSlotStack.back(), ParentFP)); @@ -2114,10 +2113,9 @@ // CONTEXT *ContextRecord; // }; // int exceptioncode = exception_pointers->ExceptionRecord->ExceptionCode; - llvm::Type *RecordTy = CGM.Int32Ty->getPointerTo(); + llvm::Type *RecordTy = llvm::PointerType::getUnqual(CGM.Int32Ty); llvm::Type *PtrsTy = llvm::StructType::get(RecordTy, CGM.VoidPtrTy); - llvm::Value *Ptrs = Builder.CreateBitCast(SEHInfo, PtrsTy->getPointerTo()); - llvm::Value *Rec = Builder.CreateStructGEP(PtrsTy, Ptrs, 0); + llvm::Value *Rec = Builder.CreateStructGEP(PtrsTy, SEHInfo, 0); Rec = Builder.CreateAlignedLoad(RecordTy, Rec, getPointerAlign()); llvm::Value *Code = Builder.CreateAlignedLoad(Int32Ty, Rec, getIntAlign()); assert(!SEHCodeSlotStack.empty() && "emitting EH code outside of __except"); diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp --- a/clang/lib/CodeGen/CGExprCXX.cpp +++ b/clang/lib/CodeGen/CGExprCXX.cpp @@ -2196,7 +2196,7 @@ llvm::Value *CodeGenFunction::EmitCXXTypeidExpr(const CXXTypeidExpr *E) { llvm::Type *StdTypeInfoPtrTy = - ConvertType(E->getType())->getPointerTo(); + llvm::PointerType::getUnqual(ConvertType(E->getType())); if (E->isTypeOperand()) { llvm::Constant *TypeInfo = diff --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp --- a/clang/lib/CodeGen/CGExprConstant.cpp +++ b/clang/lib/CodeGen/CGExprConstant.cpp @@ -1834,7 +1834,7 @@ llvm::Type *origPtrTy = C->getType(); unsigned AS = origPtrTy->getPointerAddressSpace(); - llvm::Type *charPtrTy = CGM.Int8Ty->getPointerTo(AS); + llvm::Type *charPtrTy = llvm::PointerType::get(CGM.Int8Ty, AS); C = llvm::ConstantExpr::getBitCast(C, charPtrTy); C = llvm::ConstantExpr::getGetElementPtr(CGM.Int8Ty, C, getOffset()); C = llvm::ConstantExpr::getPointerCast(C, origPtrTy); @@ -1947,7 +1947,7 @@ // Handle typeid(T). if (TypeInfoLValue TI = base.dyn_cast()) { llvm::Type *StdTypeInfoPtrTy = - CGM.getTypes().ConvertType(base.getTypeInfoType())->getPointerTo(); + llvm::PointerType::getUnqual(CGM.getTypes().ConvertType(base.getTypeInfoType())); llvm::Constant *TypeInfo = CGM.GetAddrOfRTTIDescriptor(QualType(TI.getType(), 0)); if (TypeInfo->getType() != StdTypeInfoPtrTy) diff --git a/clang/lib/CodeGen/CGObjCRuntime.cpp b/clang/lib/CodeGen/CGObjCRuntime.cpp --- a/clang/lib/CodeGen/CGObjCRuntime.cpp +++ b/clang/lib/CodeGen/CGObjCRuntime.cpp @@ -370,7 +370,8 @@ CGM.getTypes().arrangeObjCMessageSendSignature(method, callArgs[0].Ty); llvm::PointerType *signatureType = - CGM.getTypes().GetFunctionType(signature)->getPointerTo(ProgramAS); + llvm::PointerType::get(CGM.getTypes().GetFunctionType(signature), + ProgramAS); const CGFunctionInfo &signatureForCall = CGM.getTypes().arrangeCall(signature, callArgs); @@ -384,7 +385,8 @@ // Derive the signature to call from that. llvm::PointerType *signatureType = - CGM.getTypes().GetFunctionType(argsInfo)->getPointerTo(ProgramAS); + llvm::PointerType::get(CGM.getTypes().GetFunctionType(argsInfo), + ProgramAS); return MessageSendInfo(argsInfo, signatureType); } diff --git a/clang/lib/CodeGen/CodeGenTypes.cpp b/clang/lib/CodeGen/CodeGenTypes.cpp --- a/clang/lib/CodeGen/CodeGenTypes.cpp +++ b/clang/lib/CodeGen/CodeGenTypes.cpp @@ -770,7 +770,7 @@ // recursive conversion. llvm::Type *T = ConvertTypeForMem(cast(Ty)->getPointeeType()); - ResultType = T->getPointerTo(); + ResultType = llvm::PointerType::getUnqual(T); break; } diff --git a/clang/lib/CodeGen/ItaniumCXXABI.cpp b/clang/lib/CodeGen/ItaniumCXXABI.cpp --- a/clang/lib/CodeGen/ItaniumCXXABI.cpp +++ b/clang/lib/CodeGen/ItaniumCXXABI.cpp @@ -687,7 +687,8 @@ {VFPAddr, llvm::ConstantInt::get(CGM.Int32Ty, 0), TypeId}); CheckResult = Builder.CreateExtractValue(CheckedLoad, 1); VirtualFn = Builder.CreateExtractValue(CheckedLoad, 0); - VirtualFn = Builder.CreateBitCast(VirtualFn, FTy->getPointerTo(), + VirtualFn = Builder.CreateBitCast(VirtualFn, + llvm::PointerType::getUnqual(FTy), "memptr.virtualfn"); } else { // When not doing VFE, emit a normal load, as it allows more @@ -709,14 +710,11 @@ CGM.getIntrinsic(llvm::Intrinsic::load_relative, {VTableOffset->getType()}), {VTable, VTableOffset}); - VirtualFn = CGF.Builder.CreateBitCast(VirtualFn, FTy->getPointerTo()); } else { llvm::Value *VFPAddr = CGF.Builder.CreateGEP(CGF.Int8Ty, VTable, VTableOffset); - VFPAddr = CGF.Builder.CreateBitCast( - VFPAddr, FTy->getPointerTo()->getPointerTo()); VirtualFn = CGF.Builder.CreateAlignedLoad( - FTy->getPointerTo(), VFPAddr, CGF.getPointerAlign(), + llvm::PointerType::getUnqual(FTy), VFPAddr, CGF.getPointerAlign(), "memptr.virtualfn"); } } @@ -758,7 +756,7 @@ // function pointer. CGF.EmitBlock(FnNonVirtual); llvm::Value *NonVirtualFn = - Builder.CreateIntToPtr(FnAsInt, FTy->getPointerTo(), "memptr.nonvirtualfn"); + Builder.CreateIntToPtr(FnAsInt, llvm::PointerType::getUnqual(FTy), "memptr.nonvirtualfn"); // Check the function pointer if CFI on member function pointers is enabled. if (ShouldEmitCFICheck) { @@ -799,7 +797,7 @@ // We're done. CGF.EmitBlock(FnEnd); - llvm::PHINode *CalleePtr = Builder.CreatePHI(FTy->getPointerTo(), 2); + llvm::PHINode *CalleePtr = Builder.CreatePHI(llvm::PointerType::getUnqual(FTy), 2); CalleePtr->addIncoming(VirtualFn, FnVirtual); CalleePtr->addIncoming(NonVirtualFn, FnNonVirtual); @@ -825,8 +823,8 @@ // Cast the address to the appropriate pointer type, adopting the // address space of the base pointer. - llvm::Type *PType = CGF.ConvertTypeForMem(MPT->getPointeeType()) - ->getPointerTo(Base.getAddressSpace()); + llvm::Type *PType = llvm::PointerType::get(CGF.ConvertTypeForMem(MPT->getPointeeType()), + Base.getAddressSpace()); return Builder.CreateBitCast(Addr, PType); } @@ -1213,7 +1211,7 @@ auto *ClassDecl = cast(ElementType->castAs()->getDecl()); llvm::Value *VTable = - CGF.GetVTablePtr(Ptr, CGF.IntPtrTy->getPointerTo(), ClassDecl); + CGF.GetVTablePtr(Ptr, llvm::PointerType::getUnqual(CGF.IntPtrTy), ClassDecl); // Track back to entry -2 and pull out the offset there. llvm::Value *OffsetPtr = CGF.Builder.CreateConstInBoundsGEP1_64( @@ -1418,7 +1416,7 @@ auto *ClassDecl = cast(SrcRecordTy->castAs()->getDecl()); llvm::Value *Value = - CGF.GetVTablePtr(ThisPtr, StdTypeInfoPtrTy->getPointerTo(), ClassDecl); + CGF.GetVTablePtr(ThisPtr, llvm::PointerType::getUnqual(StdTypeInfoPtrTy), ClassDecl); if (CGM.getItaniumVTableContext().isRelativeLayout()) { // Load the type info. @@ -1426,9 +1424,6 @@ Value = CGF.Builder.CreateCall( CGM.getIntrinsic(llvm::Intrinsic::load_relative, {CGM.Int32Ty}), {Value, llvm::ConstantInt::get(CGM.Int32Ty, -4)}); - - // Setup to dereference again since this is a proxy we accessed. - Value = CGF.Builder.CreateBitCast(Value, StdTypeInfoPtrTy->getPointerTo()); } else { // Load the type info. Value = @@ -1497,7 +1492,7 @@ if (CGM.getItaniumVTableContext().isRelativeLayout()) { // Get the vtable pointer. llvm::Value *VTable = - CGF.GetVTablePtr(ThisAddr, CGM.Int32Ty->getPointerTo(), ClassDecl); + CGF.GetVTablePtr(ThisAddr, llvm::PointerType::getUnqual(CGM.Int32Ty), ClassDecl); // Get the offset-to-top from the vtable. OffsetToTop = @@ -1510,7 +1505,7 @@ // Get the vtable pointer. llvm::Value *VTable = - CGF.GetVTablePtr(ThisAddr, PtrDiffLTy->getPointerTo(), ClassDecl); + CGF.GetVTablePtr(ThisAddr, llvm::PointerType::getUnqual(PtrDiffLTy), ClassDecl); // Get the offset-to-top from the vtable. OffsetToTop = @@ -1549,14 +1544,10 @@ llvm::Value *VBaseOffset; if (CGM.getItaniumVTableContext().isRelativeLayout()) { - VBaseOffsetPtr = - CGF.Builder.CreateBitCast(VBaseOffsetPtr, CGF.Int32Ty->getPointerTo()); VBaseOffset = CGF.Builder.CreateAlignedLoad( CGF.Int32Ty, VBaseOffsetPtr, CharUnits::fromQuantity(4), "vbase.offset"); } else { - VBaseOffsetPtr = CGF.Builder.CreateBitCast(VBaseOffsetPtr, - CGM.PtrDiffTy->getPointerTo()); VBaseOffset = CGF.Builder.CreateAlignedLoad( CGM.PtrDiffTy, VBaseOffsetPtr, CGF.getPointerAlign(), "vbase.offset"); } @@ -1922,10 +1913,10 @@ Address This, llvm::Type *Ty, SourceLocation Loc) { - llvm::Type *TyPtr = Ty->getPointerTo(); + llvm::Type *TyPtr = llvm::PointerType::getUnqual(Ty); auto *MethodDecl = cast(GD.getDecl()); llvm::Value *VTable = CGF.GetVTablePtr( - This, TyPtr->getPointerTo(), MethodDecl->getParent()); + This, llvm::PointerType::getUnqual(TyPtr), MethodDecl->getParent()); uint64_t VTableIndex = CGM.getItaniumVTableContext().getMethodVTableIndex(GD); llvm::Value *VFunc; @@ -1946,8 +1937,6 @@ {VTable, llvm::ConstantInt::get(CGM.Int32Ty, 4 * VTableIndex)}); VFuncLoad = CGF.Builder.CreateBitCast(Load, TyPtr); } else { - VTable = - CGF.Builder.CreateBitCast(VTable, TyPtr->getPointerTo()); llvm::Value *VTableSlotPtr = CGF.Builder.CreateConstInBoundsGEP1_64( TyPtr, VTable, VTableIndex, "vfn"); VFuncLoad = @@ -2094,8 +2083,6 @@ CGF.Int8Ty, VTablePtr, VirtualAdjustment); if (CGF.CGM.getItaniumVTableContext().isRelativeLayout()) { // Load the adjustment offset from the vtable as a 32-bit int. - OffsetPtr = - CGF.Builder.CreateBitCast(OffsetPtr, CGF.Int32Ty->getPointerTo()); Offset = CGF.Builder.CreateAlignedLoad(CGF.Int32Ty, OffsetPtr, CharUnits::fromQuantity(4)); @@ -2103,9 +2090,6 @@ llvm::Type *PtrDiffTy = CGF.ConvertType(CGF.getContext().getPointerDiffType()); - OffsetPtr = - CGF.Builder.CreateBitCast(OffsetPtr, PtrDiffTy->getPointerTo()); - // Load the adjustment offset from the vtable. Offset = CGF.Builder.CreateAlignedLoad(PtrDiffTy, OffsetPtr, CGF.getPointerAlign()); @@ -2230,7 +2214,7 @@ // We can't simply ignore this load using nosanitize metadata because // the metadata may be lost. llvm::FunctionType *FTy = - llvm::FunctionType::get(CGF.SizeTy, CGF.SizeTy->getPointerTo(0), false); + llvm::FunctionType::get(CGF.SizeTy, llvm::PointerType::getUnqual(CGF.SizeTy), false); llvm::FunctionCallee F = CGM.CreateRuntimeFunction(FTy, "__asan_load_cxx_array_cookie"); return CGF.Builder.CreateCall(F, numElementsPtr.getPointer()); @@ -2380,8 +2364,8 @@ CharUnits::fromQuantity(CGM.getDataLayout().getABITypeAlign(guardTy)); } } - llvm::PointerType *guardPtrTy = guardTy->getPointerTo( - CGF.CGM.getDataLayout().getDefaultGlobalsAddressSpace()); + llvm::PointerType *guardPtrTy = + llvm::PointerType::get(guardTy, CGF.CGM.getDataLayout().getDefaultGlobalsAddressSpace()); // Create the guard variable if we don't already have it (as we // might if we're double-emitting this function body). @@ -2574,12 +2558,12 @@ // reasonably call with the default CC. Go ahead and cast it to the // right prototype. llvm::Type *dtorTy = - llvm::FunctionType::get(CGF.VoidTy, CGF.Int8PtrTy, false)->getPointerTo(); + llvm::PointerType::getUnqual(llvm::FunctionType::get(CGF.VoidTy, CGF.Int8PtrTy, false)); // Preserve address space of addr. auto AddrAS = addr ? addr->getType()->getPointerAddressSpace() : 0; auto AddrInt8PtrTy = - AddrAS ? CGF.Int8Ty->getPointerTo(AddrAS) : CGF.Int8PtrTy; + AddrAS ? llvm::PointerType::get(CGF.Int8Ty, AddrAS) : CGF.Int8PtrTy; // Create a variable that binds the atexit to this shared object. llvm::Constant *handle = @@ -2639,7 +2623,6 @@ // Get the destructor function type, void(*)(void). llvm::FunctionType *dtorFuncTy = llvm::FunctionType::get(CGF.VoidTy, false); - llvm::Type *dtorTy = dtorFuncTy->getPointerTo(); // Destructor functions are run/unregistered in non-ascending // order of their priorities. @@ -2649,10 +2632,8 @@ llvm::Function *Dtor = *itv; // We're assuming that the destructor function is something we can - // reasonably call with the correct CC. Go ahead and cast it to the - // right prototype. - llvm::Constant *dtor = llvm::ConstantExpr::getBitCast(Dtor, dtorTy); - llvm::Value *V = CGF.unregisterGlobalDtorWithUnAtExit(dtor); + // reasonably call with the correct CC. + llvm::Value *V = CGF.unregisterGlobalDtorWithUnAtExit(Dtor); llvm::Value *NeedsDestruct = CGF.Builder.CreateIsNull(V, "needs_destruct"); @@ -2667,7 +2648,7 @@ CGF.EmitBlock(DestructCallBlock); // Emit the call to casted Dtor. - llvm::CallInst *CI = CGF.Builder.CreateCall(dtorFuncTy, dtor); + llvm::CallInst *CI = CGF.Builder.CreateCall(dtorFuncTy, Dtor); // Make sure the call and the callee agree on calling convention. CI->setCallingConv(Dtor->getCallingConv()); @@ -2707,15 +2688,9 @@ if (getCodeGenOpts().CXAAtExit) { emitGlobalDtorWithCXAAtExit(CGF, Dtor, nullptr, false); } else { - // Get the destructor function type, void(*)(void). - llvm::Type *dtorTy = - llvm::FunctionType::get(CGF.VoidTy, false)->getPointerTo(); - // We're assuming that the destructor function is something we can - // reasonably call with the correct CC. Go ahead and cast it to the - // right prototype. - CGF.registerGlobalDtorWithAtExit( - llvm::ConstantExpr::getBitCast(Dtor, dtorTy)); + // reasonably call with the correct CC. + CGF.registerGlobalDtorWithAtExit(Dtor); } } @@ -4567,10 +4542,7 @@ // Otherwise, it returns a pointer into the exception object. - llvm::Type *PtrTy = LLVMCatchTy->getPointerTo(0); // addrspace 0 ok - llvm::Value *Cast = CGF.Builder.CreateBitCast(AdjustedExn, PtrTy); - - LValue srcLV = CGF.MakeNaturalAlignAddrLValue(Cast, CatchType); + LValue srcLV = CGF.MakeNaturalAlignAddrLValue(AdjustedExn, CatchType); LValue destLV = CGF.MakeAddrLValue(ParamAddr, CatchType); switch (TEK) { case TEK_Complex: @@ -4592,7 +4564,7 @@ auto catchRD = CatchType->getAsCXXRecordDecl(); CharUnits caughtExnAlignment = CGF.CGM.getClassPointerAlignment(catchRD); - llvm::Type *PtrTy = LLVMCatchTy->getPointerTo(0); // addrspace 0 ok + llvm::Type *PtrTy = llvm::PointerType::get(LLVMCatchTy, 0); // addrspace 0 ok // Check for a copy expression. If we don't have a copy expression, // that means a trivial copy is okay. @@ -4783,7 +4755,7 @@ // atexit routine expects "int(*)(int,...)" llvm::FunctionType *FTy = llvm::FunctionType::get(CGM.IntTy, CGM.IntTy, true); - llvm::PointerType *FpTy = FTy->getPointerTo(); + llvm::PointerType *FpTy = llvm::PointerType::getUnqual(FTy); // extern "C" int __pt_atexit_np(int flags, int(*)(int,...), ...); llvm::FunctionType *AtExitTy = diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -402,7 +402,7 @@ llvm::Type *DirectTy = CGF.ConvertTypeForMem(ValueTy), *ElementTy = DirectTy; if (IsIndirect) { unsigned AllocaAS = CGF.CGM.getDataLayout().getAllocaAddrSpace(); - DirectTy = DirectTy->getPointerTo(AllocaAS); + DirectTy = llvm::PointerType::get(DirectTy, AllocaAS); } Address Addr = emitVoidPtrDirectVAArg(CGF, VAListAddr, DirectTy, DirectSize, @@ -2042,7 +2042,7 @@ Info = ABIArgInfo::getInAlloca(FrameFields.size(), IsIndirect); llvm::Type *LLTy = CGT.ConvertTypeForMem(Type); if (IsIndirect) - LLTy = LLTy->getPointerTo(0); + LLTy = llvm::PointerType::getUnqual(LLTy); FrameFields.push_back(LLTy); StackOffset += IsIndirect ? WordSize : getContext().getTypeSizeInChars(Type); @@ -4851,7 +4851,7 @@ Builder.CreateCondBr(CC, UsingRegs, UsingOverflow); llvm::Type *DirectTy = CGF.ConvertType(Ty), *ElementTy = DirectTy; - if (isIndirect) DirectTy = DirectTy->getPointerTo(0); + if (isIndirect) DirectTy = llvm::PointerType::getUnqual(DirectTy); // Case 1: consume registers. Address RegAddr = Address::invalid();