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

Jan Voung via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 16 08:06:40 PDT 2024


================
@@ -806,6 +806,38 @@ bool canSkipDef(MemoryDef *D, bool DefVisibleToCaller) {
   return false;
 }
 
+// A memory location wrapper that represents a MemoryLocation, `MemLoc`,
+// defined by `MemDef`.
+class MemoryLocationWrapper {
+public:
+  MemoryLocationWrapper(MemoryLocation MemLoc, MemoryDef *MemDef)
+      : MemLoc(MemLoc), MemDef(MemDef) {
+    assert(MemLoc.Ptr && "MemLoc should be not null");
+    UnderlyingObject = getUnderlyingObject(MemLoc.Ptr);
+    DefInst = MemDef->getMemoryInst();
+  }
+
+  MemoryAccess *GetDefiningAccess() const {
----------------
jvoung wrote:

nit: function name should start with lower case?

Or I wonder if this should be inlined? There are some old comments like on line 1380 about "KillingDef" that is now represented by KillingLoc.MemDef instead?

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


More information about the llvm-commits mailing list