[llvm] [SandboxVec][DAG] Implement DGNode::isMem() (PR #109504)

Thorsten Schütt via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 21 08:46:47 PDT 2024


================
@@ -35,9 +35,16 @@ class DGNode {
   Instruction *I;
   /// Memory predecessors.
   DenseSet<DGNode *> MemPreds;
+  /// This is true if this may read/write memory, or if it has some ordering
+  /// constraings, like with stacksave/stackrestore and alloca/inalloca.
+  bool IsMem;
 
 public:
-  DGNode(Instruction *I) : I(I) {}
+  DGNode(Instruction *I) : I(I) {
+    IsMem = I->isMemDepCandidate() ||
+            (isa<AllocaInst>(I) && cast<AllocaInst>(I)->isUsedWithInAlloca()) ||
----------------
tschuett wrote:

isa + cast anti-pattern -> dyn_cast

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


More information about the llvm-commits mailing list