@@ -1823,14 +1823,6 @@ ConstantFolder::processWorkList() {
1823
1823
}
1824
1824
1825
1825
// Go through all users of the constant and try to fold them.
1826
- //
1827
- // FIXME: remove this temporary deleter. It is dangerous because any use of
1828
- // the original deleter will invalidate its iterators. It is currently used
1829
- // to work around bugs that are exposed in the -Onone stdlib build when the
1830
- // same deleter is used for both the dead code elimination above and the
1831
- // dead use elimination below.
1832
- auto tempCallbacks = deleter.getCallbacks ();
1833
- InstructionDeleter tempDeleter (std::move (tempCallbacks));
1834
1826
1835
1827
for (auto Result : I->getResults ()) {
1836
1828
for (auto *Use : Result->getUses ()) {
@@ -1855,7 +1847,7 @@ ConstantFolder::processWorkList() {
1855
1847
// this as part of the constant folding logic, because there is no value
1856
1848
// they can produce (other than empty tuple, which is wasteful).
1857
1849
if (isa<CondFailInst>(User))
1858
- tempDeleter .trackIfDead (User);
1850
+ deleter .trackIfDead (User);
1859
1851
1860
1852
// See if we have an instruction that is read none and has a stateless
1861
1853
// inverse. If we do, add it to the worklist so we can check its users
@@ -1961,15 +1953,15 @@ ConstantFolder::processWorkList() {
1961
1953
// it, we exit the worklist as expected.
1962
1954
SILValue r = User->getResult (Index);
1963
1955
if (r->use_empty ()) {
1964
- tempDeleter .trackIfDead (User);
1956
+ deleter .trackIfDead (User);
1965
1957
continue ;
1966
1958
}
1967
1959
1968
1960
// Otherwise, do the RAUW.
1969
1961
User->getResult (Index)->replaceAllUsesWith (C);
1970
1962
// Record the user if it is dead to perform the necessary cleanups
1971
1963
// later.
1972
- tempDeleter .trackIfDead (User);
1964
+ deleter .trackIfDead (User);
1973
1965
1974
1966
// The new constant could be further folded now, add it to the
1975
1967
// worklist.
@@ -1981,7 +1973,7 @@ ConstantFolder::processWorkList() {
1981
1973
1982
1974
// Eagerly DCE. We do this after visiting all users to ensure we don't
1983
1975
// invalidate the uses iterator.
1984
- tempDeleter .cleanupDeadInstructions ();
1976
+ deleter .cleanupDeadInstructions ();
1985
1977
}
1986
1978
1987
1979
// TODO: refactor this code outside of the method. Passes should not merge
0 commit comments