@@ -166,7 +166,6 @@ CastOptimizer::optimizeBridgedObjCToSwiftCast(SILDynamicCastInst dynamicCast) {
166
166
SILInstruction *Inst = dynamicCast.getInstruction ();
167
167
bool isConditional = dynamicCast.isConditional ();
168
168
SILValue Dest = dynamicCast.getDest ();
169
- CanType BridgedTargetTy = dynamicCast.getBridgedTargetType ();
170
169
SILBasicBlock *SuccessBB = dynamicCast.getSuccessBlock ();
171
170
SILBasicBlock *FailureBB = dynamicCast.getFailureBlock ();
172
171
auto *F = Inst->getFunction ();
@@ -186,9 +185,6 @@ CastOptimizer::optimizeBridgedObjCToSwiftCast(SILDynamicCastInst dynamicCast) {
186
185
ParameterConvention::Direct_Guaranteed &&
187
186
" Parameter should be @guaranteed" );
188
187
189
- CanType CanBridgedTy = BridgedTargetTy->getCanonicalType ();
190
- SILType silBridgedTy = SILType::getPrimitiveObjectType (CanBridgedTy);
191
-
192
188
SILBuilderWithScope Builder (Inst, builderContext);
193
189
194
190
// If this is a conditional cast:
@@ -215,6 +211,8 @@ CastOptimizer::optimizeBridgedObjCToSwiftCast(SILDynamicCastInst dynamicCast) {
215
211
SILValue load =
216
212
Builder.createLoad (Loc, src, LoadOwnershipQualifier::Unqualified);
217
213
214
+ SILType silBridgedTy = *dynamicCast.getLoweredBridgedTargetObjectType ();
215
+
218
216
// If type of the source and the expected ObjC type are equal, there is no
219
217
// need to generate the conversion from ObjCTy to
220
218
// _ObjectiveCBridgeable._ObjectiveCType.
0 commit comments