@@ -416,13 +416,10 @@ CombinedResultAndErrorType irgen::combineResultAndTypedErrorType(
416
416
assert (error->isIntOrPtrTy () &&
417
417
" Direct errors must only consist of int or ptr values" );
418
418
result.errorValueMapping .push_back (combined.size ());
419
-
420
- if (res == error) {
419
+ if (res->getPrimitiveSizeInBits () >= error->getPrimitiveSizeInBits ()) {
421
420
combined.push_back (res);
422
421
} 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);
426
423
}
427
424
428
425
++resIt;
@@ -2868,12 +2865,10 @@ class SyncCallEmission final : public CallEmission {
2868
2865
if (auto *structTy = dyn_cast<llvm::StructType>(
2869
2866
nativeSchema.getExpandedType (IGF.IGM ))) {
2870
2867
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]);
2873
2869
}
2874
2870
} else {
2875
- resultExplosion.add (
2876
- convertIfNecessary (combined.combinedTy , values[0 ]));
2871
+ resultExplosion.add (values[0 ]);
2877
2872
}
2878
2873
out = nativeSchema.mapFromNative (IGF.IGM , IGF, resultExplosion,
2879
2874
resultType);
@@ -5744,9 +5739,6 @@ void IRGenFunction::emitScalarReturn(SILType returnResultType,
5744
5739
eltTy->getPrimitiveSizeInBits ()) {
5745
5740
assert (nativeTy->getPrimitiveSizeInBits () >
5746
5741
eltTy->getPrimitiveSizeInBits ());
5747
- if (eltTy->isPointerTy ()) {
5748
- return Builder.CreatePtrToInt (elt, nativeTy);
5749
- }
5750
5742
return Builder.CreateZExt (elt, nativeTy);
5751
5743
}
5752
5744
return elt;
0 commit comments