File tree Expand file tree Collapse file tree 3 files changed +46
-2
lines changed Expand file tree Collapse file tree 3 files changed +46
-2
lines changed Original file line number Diff line number Diff line change @@ -76,8 +76,6 @@ bool SILLoop::canDuplicate(SILInstruction *I) const {
76
76
return false ;
77
77
}
78
78
79
- assert (I->isTriviallyDuplicatable () &&
80
- " Code here must match isTriviallyDuplicatable in SILInstruction" );
81
79
return true ;
82
80
}
83
81
Original file line number Diff line number Diff line change @@ -983,6 +983,10 @@ bool SILInstruction::isTriviallyDuplicatable() const {
983
983
if (isa<AllocStackInst>(this ) || isa<DeallocStackInst>(this )) {
984
984
return false ;
985
985
}
986
+ if (auto *ARI = dyn_cast<AllocRefInst>(this )) {
987
+ if (ARI->canAllocOnStack ())
988
+ return false ;
989
+ }
986
990
987
991
if (isa<OpenExistentialAddrInst>(this ) ||
988
992
isa<OpenExistentialRefInst>(this ) ||
Original file line number Diff line number Diff line change @@ -1246,6 +1246,48 @@ bb7:
1246
1246
br bb1
1247
1247
}
1248
1248
1249
+ sil @unknown2 : $@convention(thin) () -> ()
1250
+
1251
+ // CHECK-LABEL: no_checked_cast_br_threading_with_alloc_ref_stack
1252
+ // CHECK: checked_cast_br
1253
+ // CHECK: apply
1254
+ // CHECK: apply
1255
+ // CHECK: checked_cast_br
1256
+ // CHECK: apply
1257
+ // CHECK: apply
1258
+ // CHECK: return
1259
+ sil @no_checked_cast_br_threading_with_alloc_ref_stack : $@convention(method) (@guaranteed Base) -> () {
1260
+ bb0(%0 : $Base):
1261
+ %fu = function_ref @unknown : $@convention(thin) () -> ()
1262
+ %fu2 = function_ref @unknown2 : $@convention(thin) () -> ()
1263
+ checked_cast_br [exact] %0 : $Base to $Base, bb1, bb2
1264
+
1265
+ bb1(%1 : $Base):
1266
+ apply %fu() : $@convention(thin) () -> ()
1267
+ br bb3
1268
+
1269
+ bb2:
1270
+ apply %fu2() : $@convention(thin) () -> ()
1271
+ br bb3
1272
+
1273
+ bb3:
1274
+ %a = alloc_ref [stack] $Base
1275
+ checked_cast_br [exact] %0 : $Base to $Base, bb4, bb5
1276
+
1277
+ bb4(%2 : $Base):
1278
+ apply %fu() : $@convention(thin) () -> ()
1279
+ br bb6
1280
+
1281
+ bb5:
1282
+ apply %fu2() : $@convention(thin) () -> ()
1283
+ br bb6
1284
+
1285
+ bb6:
1286
+ dealloc_ref [stack] %a : $Base
1287
+ %r = tuple()
1288
+ return %r : $()
1289
+ }
1290
+
1249
1291
1250
1292
// CHECK-LABEL: sil @jumpthread_switch_enum
1251
1293
// CHECK-NOT: switch_enum
You can’t perform that action at this time.
0 commit comments