@@ -91,7 +91,7 @@ convertObjectToLoadableBridgeableType(SILBuilderWithScope &builder,
91
91
bool isConditional = dynamicCast.isConditional ();
92
92
93
93
SILValue load =
94
- builder.createLoad (loc, src, LoadOwnershipQualifier::Unqualified );
94
+ builder.emitLoadValueOperation (loc, src, LoadOwnershipQualifier::Take );
95
95
96
96
SILType silBridgedTy = *dynamicCast.getLoweredBridgedTargetObjectType ();
97
97
@@ -295,25 +295,25 @@ CastOptimizer::optimizeBridgedObjCToSwiftCast(SILDynamicCastInst dynamicCast) {
295
295
}
296
296
297
297
// Emit a retain.
298
- Builder.createRetainValue (Loc, srcOp, Builder. getDefaultAtomicity () );
298
+ SILValue srcArg = Builder.emitCopyValueOperation (Loc, srcOp);
299
299
300
300
SmallVector<SILValue, 1 > Args;
301
301
Args.push_back (InOutOptionalParam);
302
- Args.push_back (srcOp );
302
+ Args.push_back (srcArg );
303
303
Args.push_back (MetaTyVal);
304
304
305
305
auto *AI = Builder.createApply (Loc, funcRef, subMap, Args);
306
306
307
307
// If we have guaranteed normal arguments, insert the destroy.
308
308
//
309
309
// TODO: Is it safe to just eliminate the initial retain?
310
- Builder.createReleaseValue (Loc, srcOp, Builder. getDefaultAtomicity () );
310
+ Builder.emitDestroyValueOperation (Loc, srcArg );
311
311
312
312
// If we have an unconditional_checked_cast_addr, return early. We do not need
313
313
// to handle any conditional code.
314
314
if (isa<UnconditionalCheckedCastAddrInst>(Inst)) {
315
315
// Destroy the source value as unconditional_checked_cast_addr would.
316
- Builder.createReleaseValue (Loc, srcOp, Builder. getDefaultAtomicity () );
316
+ Builder.emitDestroyValueOperation (Loc, srcOp);
317
317
eraseInstAction (Inst);
318
318
return (newI) ? newI : AI;
319
319
}
0 commit comments