@@ -122,7 +122,7 @@ RawAddress CodeGenFunction::CreateTempAlloca(llvm::Type *Ty, CharUnits Align,
122122 Builder.SetInsertPoint (getPostAllocaInsertPoint ());
123123 V = getTargetHooks ().performAddrSpaceCast (
124124 *this , V, getASTAllocaAddressSpace (), LangAS::Default,
125- Ty-> getPointerTo (DestAddrSpace), /* non-null*/ true );
125+ Builder. getPtrTy (DestAddrSpace), /* non-null*/ true );
126126 }
127127
128128 return RawAddress (V, Ty, Align, KnownNonNull);
@@ -469,7 +469,8 @@ static RawAddress createReferenceTemporary(CodeGenFunction &CGF,
469469 if (AS != LangAS::Default)
470470 C = TCG.performAddrSpaceCast (
471471 CGF.CGM , GV, AS, LangAS::Default,
472- GV->getValueType ()->getPointerTo (
472+ llvm::PointerType::get (
473+ CGF.getLLVMContext (),
473474 CGF.getContext ().getTargetAddressSpace (LangAS::Default)));
474475 // FIXME: Should we put the new global into a COMDAT?
475476 return RawAddress (C, GV->getValueType (), alignment);
@@ -3207,7 +3208,7 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) {
32073208
32083209 if (AS != T.getAddressSpace ()) {
32093210 auto TargetAS = getContext ().getTargetAddressSpace (T.getAddressSpace ());
3210- auto PtrTy = ATPO. getElementType ()-> getPointerTo ( TargetAS);
3211+ auto PtrTy = llvm::PointerType::get (CGM. getLLVMContext (), TargetAS);
32113212 auto ASC = getTargetHooks ().performAddrSpaceCast (
32123213 CGM, ATPO.getPointer (), AS, T.getAddressSpace (), PtrTy);
32133214 ATPO = ConstantAddress (ASC, ATPO.getElementType (), ATPO.getAlignment ());
@@ -3835,9 +3836,7 @@ void CodeGenFunction::EmitCfiCheckFail() {
38353836 llvm::StructType::get (Int8Ty, SourceLocationTy, VoidPtrTy);
38363837
38373838 llvm::Value *V = Builder.CreateConstGEP2_32 (
3838- CfiCheckFailDataTy,
3839- Builder.CreatePointerCast (Data, CfiCheckFailDataTy->getPointerTo (0 )), 0 ,
3840- 0 );
3839+ CfiCheckFailDataTy, Builder.CreatePointerCast (Data, UnqualPtrTy), 0 , 0 );
38413840
38423841 Address CheckKindAddr (V, Int8Ty, getIntAlign ());
38433842 llvm::Value *CheckKind = Builder.CreateLoad (CheckKindAddr);
@@ -6115,36 +6114,6 @@ RValue CodeGenFunction::EmitCall(QualType CalleeType,
61156114 if (ResolvedFnInfo)
61166115 *ResolvedFnInfo = &FnInfo;
61176116
6118- // C99 6.5.2.2p6:
6119- // If the expression that denotes the called function has a type
6120- // that does not include a prototype, [the default argument
6121- // promotions are performed]. If the number of arguments does not
6122- // equal the number of parameters, the behavior is undefined. If
6123- // the function is defined with a type that includes a prototype,
6124- // and either the prototype ends with an ellipsis (, ...) or the
6125- // types of the arguments after promotion are not compatible with
6126- // the types of the parameters, the behavior is undefined. If the
6127- // function is defined with a type that does not include a
6128- // prototype, and the types of the arguments after promotion are
6129- // not compatible with those of the parameters after promotion,
6130- // the behavior is undefined [except in some trivial cases].
6131- // That is, in the general case, we should assume that a call
6132- // through an unprototyped function type works like a *non-variadic*
6133- // call. The way we make this work is to cast to the exact type
6134- // of the promoted arguments.
6135- //
6136- // Chain calls use this same code path to add the invisible chain parameter
6137- // to the function type.
6138- if (isa<FunctionNoProtoType>(FnType) || Chain) {
6139- llvm::Type *CalleeTy = getTypes ().GetFunctionType (FnInfo);
6140- int AS = Callee.getFunctionPointer ()->getType ()->getPointerAddressSpace ();
6141- CalleeTy = CalleeTy->getPointerTo (AS);
6142-
6143- llvm::Value *CalleePtr = Callee.getFunctionPointer ();
6144- CalleePtr = Builder.CreateBitCast (CalleePtr, CalleeTy, " callee.knr.cast" );
6145- Callee.setFunctionPointer (CalleePtr);
6146- }
6147-
61486117 // HIP function pointer contains kernel handle when it is used in triple
61496118 // chevron. The kernel stub needs to be loaded from kernel handle and used
61506119 // as callee.
0 commit comments