Skip to content

Commit f14df42

Browse files
committed
IRGen: Code simplification coerceValue also handles bitcast
NFC
1 parent ef392c1 commit f14df42

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

lib/IRGen/GenFunc.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,11 +1437,8 @@ void irgen::emitFunctionPartialApplication(
14371437
if (isIndirectFormalParameter(*singleRefcountedConvention))
14381438
ctx = IGF.Builder.CreateLoad(ctx, IGF.IGM.getPointerAlignment());
14391439
// We might get a struct containing a pointer e.g type <{ %AClass* }>
1440-
if (!ctx->getType()->isPointerTy())
1441-
ctx = IGF.coerceValue(ctx, IGF.IGM.RefCountedPtrTy,
1442-
IGF.IGM.DataLayout);
1443-
else
1444-
ctx = IGF.Builder.CreateBitCast(ctx, IGF.IGM.RefCountedPtrTy);
1440+
if (ctx->getType() != IGF.IGM.RefCountedPtrTy)
1441+
ctx = IGF.coerceValue(ctx, IGF.IGM.RefCountedPtrTy, IGF.IGM.DataLayout);
14451442
out.add(ctx);
14461443
return;
14471444
}

0 commit comments

Comments
 (0)