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

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 12 13:39:45 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);
----------------
aeubanks wrote:

a lot of the enum values of `ChangeStateEnum` aren't actually checked. following the original code better, can we return a `std::pair<bool, bool>` of `[Changed, Shortened]`?

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


More information about the llvm-commits mailing list