Skip to content

Commit 4343178

Browse files
committed
[SIL Opaque] Always allow scalar casts
(cherry picked from commit 90ec837)
1 parent 903aaab commit 4343178

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

lib/SIL/Utils/DynamicCasts.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,20 +1281,19 @@ bool swift::emitSuccessfulIndirectUnconditionalCast(
12811281
/// Can the given cast be performed by the scalar checked-cast
12821282
/// instructions at the current SIL stage?
12831283
///
1284-
/// FIXME: Always return true for !useLoweredAddresses: Scalar casts are always
1284+
/// Always returns true for !useLoweredAddresses. Scalar casts are always
12851285
/// valid for owned values. If the operand is +1, the case will always destroy
12861286
/// or forward it. The result is always either +1 or trivial. The cast never
12871287
/// hides a copy. doesCastPreserveOwnershipForTypes determines whether the
12881288
/// scalar cast is also compatible with guaranteed values.
12891289
bool swift::canSILUseScalarCheckedCastInstructions(SILModule &M,
12901290
CanType sourceFormalType,
12911291
CanType targetFormalType) {
1292-
if (M.useLoweredAddresses())
1293-
return canIRGenUseScalarCheckedCastInstructions(M, sourceFormalType,
1294-
targetFormalType);
1292+
if (!M.useLoweredAddresses())
1293+
return true;
12951294

1296-
return
1297-
doesCastPreserveOwnershipForTypes(M, sourceFormalType, targetFormalType);
1295+
return canIRGenUseScalarCheckedCastInstructions(M, sourceFormalType,
1296+
targetFormalType);
12981297
}
12991298

13001299
/// Can the given cast be performed by the scalar checked-cast

0 commit comments

Comments
 (0)