[llvm] [DSE] Delay deleting non-memory-defs until end of DSE. (PR #83411)

via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 29 08:32:41 PST 2024


================
@@ -2287,6 +2302,13 @@ static bool eliminateDeadStores(Function &F, AliasAnalysis &AA, MemorySSA &MSSA,
 
   MadeChange |= State.eliminateRedundantStoresOfExistingValues();
   MadeChange |= State.eliminateDeadWritesAtEndOfFunction();
+
+  while (!State.ToRemove.empty()) {
+    Instruction *DeadInst = State.ToRemove.pop_back_val();
+    assert(!MSSA.getMemoryAccess(DeadInst));
----------------
vporpo wrote:

Nit: Perhaps an assertion comment along the lines of  "Dead MemDefs are erased right away"?

https://github.com/llvm/llvm-project/pull/83411


More information about the llvm-commits mailing list