Skip to content

Commit 5d4e1d0

Browse files
authored
Merge pull request #77058 from meg-gupta/fixreleasehoisting
Update swift::canUseObject for unconditional_checked_cast
2 parents e617c4e + 4ab0a89 commit 5d4e1d0

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

lib/SILOptimizer/Analysis/ARCAnalysis.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ bool swift::canUseObject(SILInstruction *Inst) {
175175
case SILInstructionKind::UncheckedAddrCastInst:
176176
case SILInstructionKind::RefToRawPointerInst:
177177
case SILInstructionKind::RawPointerToRefInst:
178-
case SILInstructionKind::UnconditionalCheckedCastInst:
179178
case SILInstructionKind::UncheckedBitwiseCastInst:
180179
case SILInstructionKind::EndInitLetRefInst:
181180
case SILInstructionKind::BeginDeallocRefInst:

test/SILOptimizer/retain_release_code_motion.sil

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,3 +1123,18 @@ bb1:
11231123
return %5 : $()
11241124
}
11251125

1126+
// CHECK: sil @dont_hoist_release_accross_cast
1127+
// CHECK: retain
1128+
// CHECK: apply
1129+
// CHECK: unconditional_checked_cast
1130+
// CHECK: release
1131+
sil @dont_hoist_release_accross_cast : $@convention(thin) (B, B) -> () {
1132+
bb0(%0 : $B, %1: $B):
1133+
strong_retain %0: $B
1134+
apply undef() : $@convention(thin) () -> ()
1135+
%3 = unconditional_checked_cast %0 : $B to Builtin.NativeObject
1136+
strong_release %0: $B
1137+
%5 = tuple()
1138+
return %5 : $()
1139+
}
1140+

0 commit comments

Comments
 (0)