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

Momchil Velikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 16 07:21:24 PST 2022


chill added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/GVN.cpp:467
 uint32_t GVNPass::ValueTable::lookupOrAddCall(CallInst *C) {
+  if (MSSA) {
+    if (!AA->onlyReadsMemory(C)) {
----------------
I looked at this part and it looks correct:
- if we have `!AA->doesNotAccesMemory(C)` we have to assign a new unique value number to account for the possibility that the call does volatile accesses or has some other form of non-determinism.
- otherwise, if the call does not access memory, then the current memory state can't affect the return value, so we won't include it in the value number
- otherwise, we hash the memory state too.

Nevertheless, it can be rearranged a little bit.


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

https://reviews.llvm.org/D115160



More information about the llvm-commits mailing list