Skip to content

Commit 01a5351

Browse files
committed
IRGen: Code simplification coerceValue also handles bitcast
NFC
1 parent cfda992 commit 01a5351

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
@@ -1435,11 +1435,8 @@ void irgen::emitFunctionPartialApplication(
14351435
if (isIndirectFormalParameter(*singleRefcountedConvention))
14361436
ctx = IGF.Builder.CreateLoad(ctx, IGF.IGM.getPointerAlignment());
14371437
// We might get a struct containing a pointer e.g type <{ %AClass* }>
1438-
if (!ctx->getType()->isPointerTy())
1439-
ctx = IGF.coerceValue(ctx, IGF.IGM.RefCountedPtrTy,
1440-
IGF.IGM.DataLayout);
1441-
else
1442-
ctx = IGF.Builder.CreateBitCast(ctx, IGF.IGM.RefCountedPtrTy);
1438+
if (ctx->getType() != IGF.IGM.RefCountedPtrTy)
1439+
ctx = IGF.coerceValue(ctx, IGF.IGM.RefCountedPtrTy, IGF.IGM.DataLayout);
14431440
out.add(ctx);
14441441
return;
14451442
}

0 commit comments

Comments
 (0)