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

Haopeng Liu via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 19 10:17:05 PDT 2024


================
@@ -1325,17 +1366,15 @@ struct DSEState {
   // (completely) overwrite \p KillingLoc. Currently we bail out when we
   // encounter an aliasing MemoryUse (read).
   std::optional<MemoryAccess *>
-  getDomMemoryDef(MemoryDef *KillingDef, MemoryAccess *StartAccess,
-                  const MemoryLocation &KillingLoc, const Value *KillingUndObj,
+  getDomMemoryDef(MemoryLocationWrapper &KillingLoc, MemoryAccess *StartAccess,
                   unsigned &ScanLimit, unsigned &WalkerStepLimit,
-                  bool IsMemTerm, unsigned &PartialLimit) {
+                  unsigned &PartialLimit) {
     if (ScanLimit == 0 || WalkerStepLimit == 0) {
       LLVM_DEBUG(dbgs() << "\n    ...  hit scan limit\n");
       return std::nullopt;
     }
 
     MemoryAccess *Current = StartAccess;
-    Instruction *KillingI = KillingDef->getMemoryInst();
     LLVM_DEBUG(dbgs() << "  trying to get dominating access\n");
 
     // Only optimize defining access of KillingDef when directly starting at its
----------------
haopliu wrote:

Renamed "KillingLoc" parameter to "KillingLocWrapper", and updated the comments in `getDomMemoryDef` and two `eliminateDeadDefs` functions:
"KillingLoc" --> "KillingLocWrapper.MemLoc"
"KillingDef" --> "KillingLocWrapper.MemDef"

Let me know if we prefer to make a local var `KillingDef = KillingLocWrapper.MemDef`.

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


More information about the llvm-commits mailing list