File tree Expand file tree Collapse file tree 2 files changed +39
-1
lines changed
lib/SILOptimizer/LoopTransforms Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -909,7 +909,17 @@ void LoopTreeOptimization::analyzeCurrentLoop(
909
909
LoadsAndStores.push_back (&Inst);
910
910
break ;
911
911
case SILInstructionKind::StoreInst: {
912
- Stores.push_back (cast<StoreInst>(&Inst));
912
+ auto *store = cast<StoreInst>(&Inst);
913
+ switch (store->getOwnershipQualifier ()) {
914
+ case StoreOwnershipQualifier::Assign:
915
+ case StoreOwnershipQualifier::Init:
916
+ // Currently not supported.
917
+ continue ;
918
+ case StoreOwnershipQualifier::Unqualified:
919
+ case StoreOwnershipQualifier::Trivial:
920
+ break ;
921
+ }
922
+ Stores.push_back (store);
913
923
LoadsAndStores.push_back (&Inst);
914
924
checkSideEffects (Inst, sideEffects, sideEffectsInBlock);
915
925
break ;
Original file line number Diff line number Diff line change @@ -1639,3 +1639,31 @@ bb3:
1639
1639
%15 = tuple ()
1640
1640
return %15
1641
1641
}
1642
+
1643
+ // Hoisting non-trivial loads/stores is currently not supported in OSSA.
1644
+ // CHECK-LABEL: sil [ossa] @store_of_optional_none :
1645
+ // CHECK: bb2:
1646
+ // CHECK: store %0 to [assign] %1
1647
+ // CHECK: bb3:
1648
+ // CHECK-LABEL: } // end sil function 'store_of_optional_none'
1649
+ sil [ossa] @store_of_optional_none : $@convention(thin) () -> () {
1650
+ bb0:
1651
+ %0 = enum $Optional<String>, #Optional.none!enumelt
1652
+ %1 = alloc_stack $Optional<String>
1653
+ store %0 to [init] %1
1654
+ br bb1
1655
+
1656
+ bb1:
1657
+ cond_br undef, bb2, bb3
1658
+
1659
+ bb2:
1660
+ store %0 to [assign] %1
1661
+ br bb1
1662
+
1663
+ bb3:
1664
+ destroy_addr %1
1665
+ dealloc_stack %1
1666
+ %r = tuple()
1667
+ return %r : $()
1668
+ }
1669
+
You can’t perform that action at this time.
0 commit comments