[PATCH] D115160: [GVN] MemorySSA for GVN: use the incoming memory state in the value numbers

Alina Sbirlea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 3 14:57:13 PST 2022


asbirlea added inline comments.
Herald added a project: All.


================
Comment at: llvm/lib/Transforms/Scalar/GVN.cpp:2252
+    MemoryPhi *MPhi = MSSA->getMemoryAccess(BB);
+    for (unsigned I = 0, N = MPhi->getNumIncomingValues(); I != N; ++I) {
+      if (MPhi->getIncomingBlock(I) != Pred)
----------------
I'm not clear if BB always has a MemoryPhi. It's possible for a node to have PhiNodes, and no MemoryPhis.
```
if (!MPhi)
  return Num;
```
For getting the incoming value, there's an API:
```
MemoryAccess *MA = MPhi->getIncomingValueForBlock(Pred);
```


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115160/new/

https://reviews.llvm.org/D115160



More information about the llvm-commits mailing list