@@ -3204,26 +3204,6 @@ llvm::CallBase *CallEmission::emitCallSite() {
32043204 return call;
32053205}
32063206
3207- static llvm::AttributeList
3208- assertTypesInByValAndStructRetAttributes (llvm::FunctionType *fnType,
3209- llvm::AttributeList attrList) {
3210- auto &context = fnType->getContext ();
3211- if (context.supportsTypedPointers ()) {
3212- for (unsigned i = 0 ; i < fnType->getNumParams (); ++i) {
3213- auto paramTy = fnType->getParamType (i);
3214- assert (
3215- !attrList.hasParamAttr (i, llvm::Attribute::StructRet) ||
3216- llvm::cast<llvm::PointerType>(paramTy)->isOpaqueOrPointeeTypeMatches (
3217- attrList.getParamStructRetType (i)));
3218- assert (
3219- !attrList.hasParamAttr (i, llvm::Attribute::ByVal) ||
3220- llvm::cast<llvm::PointerType>(paramTy)->isOpaqueOrPointeeTypeMatches (
3221- attrList.getParamByValType (i)));
3222- }
3223- }
3224- return attrList;
3225- }
3226-
32273207llvm::CallBase *IRBuilder::CreateCallOrInvoke (
32283208 const FunctionPointer &fn, ArrayRef<llvm::Value *> args,
32293209 llvm::BasicBlock *invokeNormalDest, llvm::BasicBlock *invokeUnwindDest) {
@@ -3265,7 +3245,7 @@ llvm::CallBase *IRBuilder::CreateCallOrInvoke(
32653245 }
32663246 }
32673247 }
3268- call->setAttributes (assertTypesInByValAndStructRetAttributes (fnTy, attrs) );
3248+ call->setAttributes (attrs);
32693249 call->setCallingConv (fn.getCallingConv ());
32703250 return call;
32713251}
@@ -3462,10 +3442,6 @@ void CallEmission::emitToExplosion(Explosion &out, bool isOutlined) {
34623442 resultTy = func->getParamStructRetType (0 );
34633443 }
34643444 auto temp = IGF.createAlloca (resultTy, Alignment (), " indirect.result" );
3465- if (IGF.IGM .getLLVMContext ().supportsTypedPointers ()) {
3466- temp = IGF.Builder .CreateElementBitCast (
3467- temp, fnType->getParamType (0 )->getNonOpaquePointerElementType ());
3468- }
34693445 emitToMemory (temp, substResultTI, isOutlined);
34703446 return ;
34713447 }
@@ -3492,10 +3468,6 @@ void CallEmission::emitToExplosion(Explosion &out, bool isOutlined) {
34923468 auto resultTy = func->getParamStructRetType (1 );
34933469 auto temp = IGF.createAlloca (resultTy, Alignment (/* safe alignment*/ 16 ),
34943470 " indirect.result" );
3495- if (IGF.IGM .getLLVMContext ().supportsTypedPointers ()) {
3496- temp = IGF.Builder .CreateElementBitCast (
3497- temp, fnType->getParamType (1 )->getNonOpaquePointerElementType ());
3498- }
34993471 emitToMemory (temp, substResultTI, isOutlined);
35003472 return ;
35013473 }
@@ -5940,34 +5912,24 @@ llvm::FunctionType *FunctionPointer::getFunctionType() const {
59405912 }
59415913
59425914 if (awaitSignature) {
5943- assert (llvm::cast<llvm::PointerType>(Value->getType ())
5944- ->isOpaqueOrPointeeTypeMatches (awaitSignature));
59455915 return cast<llvm::FunctionType>(awaitSignature);
59465916 }
59475917
59485918 // Read the function type off the global or else from the Signature.
59495919 if (auto *constant = dyn_cast<llvm::Constant>(Value)) {
59505920 auto *gv = dyn_cast<llvm::GlobalValue>(Value);
59515921 if (!gv) {
5952- assert (llvm::cast<llvm::PointerType>(Value->getType ())
5953- ->isOpaqueOrPointeeTypeMatches (Sig.getType ()));
59545922 return Sig.getType ();
59555923 }
59565924
59575925 if (useSignature) { // Because of various casting (e.g thin_to_thick) the
59585926 // signature of the function Value might mismatch
59595927 // (e.g no context argument).
5960- assert (llvm::cast<llvm::PointerType>(Value->getType ())
5961- ->isOpaqueOrPointeeTypeMatches (Sig.getType ()));
59625928 return Sig.getType ();
59635929 }
59645930
5965- assert (llvm::cast<llvm::PointerType>(Value->getType ())
5966- ->isOpaqueOrPointeeTypeMatches (gv->getValueType ()));
59675931 return cast<llvm::FunctionType>(gv->getValueType ());
59685932 }
59695933
5970- assert (llvm::cast<llvm::PointerType>(Value->getType ())
5971- ->isOpaqueOrPointeeTypeMatches (Sig.getType ()));
59725934 return Sig.getType ();
59735935}
0 commit comments