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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 1 09:32:20 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));
----------------
fhahn wrote:

I went ahead and dropped the assert, as it was incorrect and never triggered, due to memory accesses always being removed from MemorySSA.

Also, in the latest version, we may remove memory-defs here, if they produce values.

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


More information about the llvm-commits mailing list