[llvm] [NewGVN] Relax conditions when checking safety of memory accesses (PR #98609)

Alina Sbirlea via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 25 11:56:49 PDT 2024


================
@@ -2597,34 +2597,61 @@ bool NewGVN::OpIsSafeForPHIOfOps(Value *V, const BasicBlock *PHIBlock,
   Worklist.push_back(V);
   while (!Worklist.empty()) {
     auto *I = Worklist.pop_back_val();
-    if (!isa<Instruction>(I))
+    if (!(isa<Instruction>(I) || isa<MemoryAccess>(I)))
----------------
alinas wrote:

I am not clear if you need this generalization or if you can keep the invariant that the worklist only has instructions and MemoryPhis. When checking operands, switch to adding the instruction corresponding to an access that's not a MemoryPhi. For all instructions, check operands for the corresponding MA and for the instruction.

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


More information about the llvm-commits mailing list