[llvm] [SandboxVec][DAG] MemDGNode for memory-dependency candidate nodes (PR #109684)

Alina Sbirlea via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 1 09:51:00 PDT 2024


================
@@ -77,10 +136,20 @@ class DependencyGraph {
     auto It = InstrToNodeMap.find(I);
     return It != InstrToNodeMap.end() ? It->second.get() : nullptr;
   }
+  /// Like getNode() but returns nullptr if \p I is nullptr.
+  DGNode *getNodeOrNull(Instruction *I) const {
+    if (I == nullptr)
+      return nullptr;
+    return getNode(I);
+  }
   DGNode *getOrCreateNode(Instruction *I) {
     auto [It, NotInMap] = InstrToNodeMap.try_emplace(I);
-    if (NotInMap)
-      It->second = std::make_unique<DGNode>(I);
+    if (NotInMap) {
+      if (I->isMemDepCandidate() || I->isStackSaveOrRestoreIntrinsic())
----------------
alinas wrote:

These conditions shouldn't be the same as in the static isMemDepCandidate?

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


More information about the llvm-commits mailing list