@@ -122,7 +122,7 @@ RawAddress CodeGenFunction::CreateTempAlloca(llvm::Type *Ty, CharUnits Align,
122
122
Builder.SetInsertPoint (getPostAllocaInsertPoint ());
123
123
V = getTargetHooks ().performAddrSpaceCast (
124
124
*this , V, getASTAllocaAddressSpace (), LangAS::Default,
125
- Ty-> getPointerTo (DestAddrSpace), /* non-null*/ true );
125
+ Builder. getPtrTy (DestAddrSpace), /* non-null*/ true );
126
126
}
127
127
128
128
return RawAddress (V, Ty, Align, KnownNonNull);
@@ -469,7 +469,8 @@ static RawAddress createReferenceTemporary(CodeGenFunction &CGF,
469
469
if (AS != LangAS::Default)
470
470
C = TCG.performAddrSpaceCast (
471
471
CGF.CGM , GV, AS, LangAS::Default,
472
- GV->getValueType ()->getPointerTo (
472
+ llvm::PointerType::get (
473
+ CGF.getLLVMContext (),
473
474
CGF.getContext ().getTargetAddressSpace (LangAS::Default)));
474
475
// FIXME: Should we put the new global into a COMDAT?
475
476
return RawAddress (C, GV->getValueType (), alignment);
@@ -3207,7 +3208,7 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) {
3207
3208
3208
3209
if (AS != T.getAddressSpace ()) {
3209
3210
auto TargetAS = getContext ().getTargetAddressSpace (T.getAddressSpace ());
3210
- auto PtrTy = ATPO. getElementType ()-> getPointerTo ( TargetAS);
3211
+ auto PtrTy = llvm::PointerType::get (CGM. getLLVMContext (), TargetAS);
3211
3212
auto ASC = getTargetHooks ().performAddrSpaceCast (
3212
3213
CGM, ATPO.getPointer (), AS, T.getAddressSpace (), PtrTy);
3213
3214
ATPO = ConstantAddress (ASC, ATPO.getElementType (), ATPO.getAlignment ());
@@ -3835,9 +3836,7 @@ void CodeGenFunction::EmitCfiCheckFail() {
3835
3836
llvm::StructType::get (Int8Ty, SourceLocationTy, VoidPtrTy);
3836
3837
3837
3838
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 );
3841
3840
3842
3841
Address CheckKindAddr (V, Int8Ty, getIntAlign ());
3843
3842
llvm::Value *CheckKind = Builder.CreateLoad (CheckKindAddr);
@@ -6115,36 +6114,6 @@ RValue CodeGenFunction::EmitCall(QualType CalleeType,
6115
6114
if (ResolvedFnInfo)
6116
6115
*ResolvedFnInfo = &FnInfo;
6117
6116
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
-
6148
6117
// HIP function pointer contains kernel handle when it is used in triple
6149
6118
// chevron. The kernel stub needs to be loaded from kernel handle and used
6150
6119
// as callee.
0 commit comments