[llvm] [DSE] Refactor DSE (PR #100956)

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 9 14:11:34 PDT 2024


================
@@ -2132,182 +2177,185 @@ struct DSEState {
     }
     return MadeChange;
   }
-};
 
-static bool eliminateDeadStores(Function &F, AliasAnalysis &AA, MemorySSA &MSSA,
-                                DominatorTree &DT, PostDominatorTree &PDT,
-                                const TargetLibraryInfo &TLI,
-                                const LoopInfo &LI) {
-  bool MadeChange = false;
+  enum class ChangeStateEnum : uint8_t {
+    NoChange,
+    DeleteByMemTerm,
+    CompleteDeleteByNonMemTerm,
+    PartiallyDeleteByNonMemTerm,
+  };
+  // Try to eliminate dead defs killed by `KillingLocWrapper` and return the
+  // change state.
+  ChangeStateEnum eliminateDeadDefs(MemoryLocationWrapper &KillingLocWrapper);
 
-  DSEState State(F, AA, MSSA, DT, PDT, TLI, LI);
-  // For each store:
-  for (unsigned I = 0; I < State.MemDefs.size(); I++) {
-    MemoryDef *KillingDef = State.MemDefs[I];
-    if (State.SkipStores.count(KillingDef))
+  // Try to eliminate dead defs killed by `KillingDefWrapper` and return the
+  // change state.
----------------
aeubanks wrote:

nit: this is returning a bool instead of a change state

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


More information about the llvm-commits mailing list