[PATCH] D35317: [EarlyCSE] Handle calls with no MemorySSA info.

Daniel Berlin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 14 00:15:12 PDT 2017


dberlin added a comment.

You may want to not treat these as memory at all, as Vedant suggested on list.

As a further example of the advantages of that approach,  i believe
"     if ((Inst->mayReadFromMemory() || Inst->mayThrow()) &&

    !(MemInst.isValid() && !MemInst.mayReadFromMemory()))
  LastStore = nullptr;"

Will still trigger in your current fix for these calls, but should not.

In fact, it can't read from memory if it has no memory access.

IE you should be able to have a testcase where your current fix avoids eliminating a store, but changing this routine to say "if memoryssa doesn't think it has an access, and it doesn't throw, it's fine", does eliminate the store.



================
Comment at: lib/Transforms/Scalar/EarlyCSE.cpp:567
+  // read/write memory, then we can safely return true here.
+  MemoryAccess *EarlierMA = MSSA->getMemoryAccess(EarlierInst);
+  MemoryAccess *LaterMA = MSSA->getMemoryAccess(LaterInst);
----------------
you can auto * these


https://reviews.llvm.org/D35317





More information about the llvm-commits mailing list