@@ -416,13 +416,10 @@ CombinedResultAndErrorType irgen::combineResultAndTypedErrorType(
416416 assert (error->isIntOrPtrTy () &&
417417 " Direct errors must only consist of int or ptr values" );
418418 result.errorValueMapping .push_back (combined.size ());
419-
420- if (res == error) {
419+ if (res->getPrimitiveSizeInBits () >= error->getPrimitiveSizeInBits ()) {
421420 combined.push_back (res);
422421 } else {
423- auto maxSize = std::max (IGM.DataLayout .getTypeSizeInBits (res),
424- IGM.DataLayout .getTypeSizeInBits (error));
425- combined.push_back (llvm::IntegerType::get (IGM.getLLVMContext (), maxSize));
422+ combined.push_back (error);
426423 }
427424
428425 ++resIt;
@@ -2868,12 +2865,10 @@ class SyncCallEmission final : public CallEmission {
28682865 if (auto *structTy = dyn_cast<llvm::StructType>(
28692866 nativeSchema.getExpandedType (IGF.IGM ))) {
28702867 for (unsigned i = 0 , e = structTy->getNumElements (); i < e; ++i) {
2871- auto *nativeTy = structTy->getElementType (i);
2872- resultExplosion.add (convertIfNecessary (nativeTy, values[i]));
2868+ resultExplosion.add (values[i]);
28732869 }
28742870 } else {
2875- resultExplosion.add (
2876- convertIfNecessary (combined.combinedTy , values[0 ]));
2871+ resultExplosion.add (values[0 ]);
28772872 }
28782873 out = nativeSchema.mapFromNative (IGF.IGM , IGF, resultExplosion,
28792874 resultType);
@@ -5744,9 +5739,6 @@ void IRGenFunction::emitScalarReturn(SILType returnResultType,
57445739 eltTy->getPrimitiveSizeInBits ()) {
57455740 assert (nativeTy->getPrimitiveSizeInBits () >
57465741 eltTy->getPrimitiveSizeInBits ());
5747- if (eltTy->isPointerTy ()) {
5748- return Builder.CreatePtrToInt (elt, nativeTy);
5749- }
57505742 return Builder.CreateZExt (elt, nativeTy);
57515743 }
57525744 return elt;
0 commit comments