@@ -1825,49 +1825,8 @@ bool SILInstruction::maySuspend() const {
1825
1825
if (auto applySite = FullApplySite::isa (const_cast <SILInstruction*>(this ))) {
1826
1826
return applySite.getOrigCalleeType ()->isAsync ();
1827
1827
}
1828
-
1829
- return false ;
1830
- }
1831
-
1832
- static bool
1833
- visitRecursivelyLifetimeEndingUses (
1834
- SILValue i, bool &noUsers,
1835
- llvm::function_ref<bool (Operand *)> visitScopeEnd,
1836
- llvm::function_ref<bool(Operand *)> visitUnknownUse) {
1837
-
1838
- StackList<SILValue> values (i->getFunction ());
1839
- values.push_back (i);
1840
-
1841
- while (!values.empty ()) {
1842
- auto value = values.pop_back_val ();
1843
- for (Operand *use : value->getConsumingUses ()) {
1844
- noUsers = false ;
1845
- if (isa<DestroyValueInst>(use->getUser ())) {
1846
- if (!visitScopeEnd (use)) {
1847
- return false ;
1848
- }
1849
- continue ;
1850
- }
1851
- if (auto *ret = dyn_cast<ReturnInst>(use->getUser ())) {
1852
- auto fnTy = ret->getFunction ()->getLoweredFunctionType ();
1853
- assert (!fnTy->getLifetimeDependencies ().empty ());
1854
- if (!visitScopeEnd (use)) {
1855
- return false ;
1856
- }
1857
- continue ;
1858
- }
1859
- // FIXME: Handle store to indirect result
1860
1828
1861
- auto *user = use->getUser ();
1862
- if (user->getNumResults () == 0 ) {
1863
- return visitUnknownUse (use);
1864
- }
1865
- for (auto res : use->getUser ()->getResults ()) {
1866
- values.push_back (res);
1867
- }
1868
- }
1869
- }
1870
- return true ;
1829
+ return false ;
1871
1830
}
1872
1831
1873
1832
bool
@@ -1964,6 +1923,47 @@ FunctionTest PartialApplyPrintOnStackLifetimeEnds(
1964
1923
});
1965
1924
} // end namespace swift::test
1966
1925
1926
+ static bool
1927
+ visitRecursivelyLifetimeEndingUses (
1928
+ SILValue i, bool &noUsers,
1929
+ llvm::function_ref<bool (Operand *)> visitScopeEnd,
1930
+ llvm::function_ref<bool(Operand *)> visitUnknownUse) {
1931
+
1932
+ StackList<SILValue> values (i->getFunction ());
1933
+ values.push_back (i);
1934
+
1935
+ while (!values.empty ()) {
1936
+ auto value = values.pop_back_val ();
1937
+ for (Operand *use : value->getConsumingUses ()) {
1938
+ noUsers = false ;
1939
+ if (isa<DestroyValueInst>(use->getUser ())) {
1940
+ if (!visitScopeEnd (use)) {
1941
+ return false ;
1942
+ }
1943
+ continue ;
1944
+ }
1945
+ if (auto *ret = dyn_cast<ReturnInst>(use->getUser ())) {
1946
+ auto fnTy = ret->getFunction ()->getLoweredFunctionType ();
1947
+ assert (!fnTy->getLifetimeDependencies ().empty ());
1948
+ if (!visitScopeEnd (use)) {
1949
+ return false ;
1950
+ }
1951
+ continue ;
1952
+ }
1953
+ // FIXME: Handle store to indirect result
1954
+
1955
+ auto *user = use->getUser ();
1956
+ if (user->getNumResults () == 0 ) {
1957
+ return visitUnknownUse (use);
1958
+ }
1959
+ for (auto res : use->getUser ()->getResults ()) {
1960
+ values.push_back (res);
1961
+ }
1962
+ }
1963
+ }
1964
+ return true ;
1965
+ }
1966
+
1967
1967
// FIXME: Rather than recursing through all results, this should only recurse
1968
1968
// through ForwardingInstruction and OwnershipTransitionInstruction and the
1969
1969
// client should prove that any other uses cannot be upstream from a consume of
0 commit comments