@@ -1823,14 +1823,6 @@ ConstantFolder::processWorkList() {
18231823 }
18241824
18251825 // 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));
18341826
18351827 for (auto Result : I->getResults ()) {
18361828 for (auto *Use : Result->getUses ()) {
@@ -1855,7 +1847,7 @@ ConstantFolder::processWorkList() {
18551847 // this as part of the constant folding logic, because there is no value
18561848 // they can produce (other than empty tuple, which is wasteful).
18571849 if (isa<CondFailInst>(User))
1858- tempDeleter .trackIfDead (User);
1850+ deleter .trackIfDead (User);
18591851
18601852 // See if we have an instruction that is read none and has a stateless
18611853 // inverse. If we do, add it to the worklist so we can check its users
@@ -1961,15 +1953,15 @@ ConstantFolder::processWorkList() {
19611953 // it, we exit the worklist as expected.
19621954 SILValue r = User->getResult (Index);
19631955 if (r->use_empty ()) {
1964- tempDeleter .trackIfDead (User);
1956+ deleter .trackIfDead (User);
19651957 continue ;
19661958 }
19671959
19681960 // Otherwise, do the RAUW.
19691961 User->getResult (Index)->replaceAllUsesWith (C);
19701962 // Record the user if it is dead to perform the necessary cleanups
19711963 // later.
1972- tempDeleter .trackIfDead (User);
1964+ deleter .trackIfDead (User);
19731965
19741966 // The new constant could be further folded now, add it to the
19751967 // worklist.
@@ -1981,7 +1973,7 @@ ConstantFolder::processWorkList() {
19811973
19821974 // Eagerly DCE. We do this after visiting all users to ensure we don't
19831975 // invalidate the uses iterator.
1984- tempDeleter .cleanupDeadInstructions ();
1976+ deleter .cleanupDeadInstructions ();
19851977 }
19861978
19871979 // TODO: refactor this code outside of the method. Passes should not merge
0 commit comments