File tree Expand file tree Collapse file tree 1 file changed +2
-14
lines changed Expand file tree Collapse file tree 1 file changed +2
-14
lines changed Original file line number Diff line number Diff line change @@ -1244,20 +1244,8 @@ static llvm::Function *emitPartialApplicationForwarder(IRGenModule &IGM,
1244
1244
// cast to the result type - it could be substituted.
1245
1245
if (origConv.getSILResultType ().hasTypeParameter ()) {
1246
1246
auto ResType = fwd->getReturnType ();
1247
- if (auto *structType = dyn_cast<llvm::StructType>(ResType)) {
1248
- // Cast all struct elements to the desired type.
1249
- llvm::Value *castResult = llvm::UndefValue::get (structType);
1250
- for (auto i : range (structType->getStructNumElements ())) {
1251
- auto desiredEltTy = structType->getElementType (i);
1252
- auto elt = subIGF.Builder .CreateExtractValue (callResult, {i});
1253
- auto castElt = subIGF.Builder .CreateBitCast (elt, desiredEltTy);
1254
- castResult =
1255
- subIGF.Builder .CreateInsertValue (castResult, castElt, {i});
1256
- }
1257
- callResult = castResult;
1258
- }
1259
- else
1260
- callResult = subIGF.Builder .CreateBitCast (callResult, ResType);
1247
+ if (ResType != callResult->getType ())
1248
+ callResult = subIGF.coerceValue (callResult, ResType, subIGF.IGM .DataLayout );
1261
1249
}
1262
1250
subIGF.Builder .CreateRet (callResult);
1263
1251
}
You can’t perform that action at this time.
0 commit comments