@@ -4518,12 +4518,12 @@ void CallEmission::emitToUnmappedExplosionWithDirectTypedError(
45184518 for (unsigned i = 0 , e = structTy->getNumElements (); i < e; ++i) {
45194519 llvm::Value *elt = values[combined.errorValueMapping [i]];
45204520 auto *nativeTy = structTy->getElementType (i);
4521- elt = convertForAsyncDirect (IGF, elt, nativeTy, /* forExtraction*/ true );
4521+ elt = convertForDirectError (IGF, elt, nativeTy, /* forExtraction*/ true );
45224522 errorExplosion.add (elt);
45234523 }
45244524 } else {
45254525 auto *converted =
4526- convertForAsyncDirect (IGF, values[combined.errorValueMapping [0 ]],
4526+ convertForDirectError (IGF, values[combined.errorValueMapping [0 ]],
45274527 combined.combinedTy , /* forExtraction*/ true );
45284528 errorExplosion.add (converted);
45294529 }
@@ -4541,12 +4541,12 @@ void CallEmission::emitToUnmappedExplosionWithDirectTypedError(
45414541 dyn_cast<llvm::StructType>(nativeSchema.getExpandedType (IGF.IGM ))) {
45424542 for (unsigned i = 0 , e = structTy->getNumElements (); i < e; ++i) {
45434543 auto *nativeTy = structTy->getElementType (i);
4544- auto *converted = convertForAsyncDirect (IGF, values[i], nativeTy,
4544+ auto *converted = convertForDirectError (IGF, values[i], nativeTy,
45454545 /* forExtraction*/ true );
45464546 resultExplosion.add (converted);
45474547 }
45484548 } else {
4549- auto *converted = convertForAsyncDirect (
4549+ auto *converted = convertForDirectError (
45504550 IGF, values[0 ], combined.combinedTy , /* forExtraction*/ true );
45514551 resultExplosion.add (converted);
45524552 }
@@ -5414,7 +5414,7 @@ llvm::Value* IRGenFunction::coerceValue(llvm::Value *value, llvm::Type *toTy,
54145414 return loaded;
54155415}
54165416
5417- llvm::Value *irgen::convertForAsyncDirect (IRGenFunction &IGF,
5417+ llvm::Value *irgen::convertForDirectError (IRGenFunction &IGF,
54185418 llvm::Value *value, llvm::Type *toTy,
54195419 bool forExtraction) {
54205420 auto &Builder = IGF.Builder ;
@@ -5424,12 +5424,9 @@ llvm::Value *irgen::convertForAsyncDirect(IRGenFunction &IGF,
54245424 if (toTy->isPointerTy ()) {
54255425 if (fromTy->isPointerTy ())
54265426 return Builder.CreateBitCast (value, toTy);
5427- if (fromTy == IGF.IGM .IntPtrTy )
5428- return Builder.CreateIntToPtr (value, toTy);
5427+ return Builder.CreateIntToPtr (value, toTy);
54295428 } else if (fromTy->isPointerTy ()) {
5430- if (toTy == IGF.IGM .IntPtrTy ) {
5431- return Builder.CreatePtrToInt (value, toTy);
5432- }
5429+ return Builder.CreatePtrToInt (value, toTy);
54335430 }
54345431
54355432 if (forExtraction) {
@@ -5887,12 +5884,12 @@ void IRGenFunction::emitScalarReturn(SILType returnResultType,
58875884 for (unsigned i = 0 , e = native.size (); i != e; ++i) {
58885885 llvm::Value *elt = native.claimNext ();
58895886 auto *nativeTy = structTy->getElementType (i);
5890- elt = convertForAsyncDirect (*this , elt, nativeTy,
5887+ elt = convertForDirectError (*this , elt, nativeTy,
58915888 /* forExtraction*/ false );
58925889 nativeAgg = Builder.CreateInsertValue (nativeAgg, elt, i);
58935890 }
58945891 } else {
5895- nativeAgg = convertForAsyncDirect (*this , native.claimNext (), combinedTy,
5892+ nativeAgg = convertForDirectError (*this , native.claimNext (), combinedTy,
58965893 /* forExtraction*/ false );
58975894 }
58985895 }
@@ -6224,7 +6221,7 @@ void irgen::emitAsyncReturn(IRGenFunction &IGF, AsyncContextLayout &asyncLayout,
62246221 for (unsigned i = 0 , e = result.size (); i != e; ++i) {
62256222 llvm::Value *elt = result.claimNext ();
62266223 auto *nativeTy = structTy->getElementType (i);
6227- elt = convertForAsyncDirect (IGF, elt, nativeTy,
6224+ elt = convertForDirectError (IGF, elt, nativeTy,
62286225 /* forExtraction*/ false );
62296226 nativeAgg = IGF.Builder .CreateInsertValue (nativeAgg, elt, i);
62306227 }
@@ -6234,7 +6231,7 @@ void irgen::emitAsyncReturn(IRGenFunction &IGF, AsyncContextLayout &asyncLayout,
62346231 nativeResultsStorage.push_back (out.claimNext ());
62356232 }
62366233 } else {
6237- auto *converted = convertForAsyncDirect (
6234+ auto *converted = convertForDirectError (
62386235 IGF, result.claimNext (), combinedTy, /* forExtraction*/ false );
62396236 nativeResultsStorage.push_back (converted);
62406237 }
0 commit comments