[PATCH] D90328: Eliminates dead store of an exisiting value

Daniel McCrevan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 2 09:50:40 PST 2020


dmccrevan added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp:2385
+      PushMemUses(Def);
+      for (unsigned I = 0; I < WorkList.size(); I++) {
+        if (WorkList.size() >= MemorySSAScanLimit) {
----------------
fhahn wrote:
> Initially it would probably be best to start with just looking at the direct uses of the def and then go from there. One thing to watch out for is compile-time.
I've been trying to figure out how to get the uses of each def, but for some reason, I keep running into an error being thrown. 

This is a snippet I am using to get the uses, but for some reason, getUser() is throwing an error.

```
MemoryAccess *DefAccess = dyn_cast<MemoryAccess>(Def);
if (isa<MemoryPhi>(DefAccess))
    continue;
for(Use &U : DefAccess->uses()) {
    MemoryAccess * UseAccess = cast<MemoryAccess>(U.getUser());
```

Any ideas how to get all of the uses from a Def?


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

https://reviews.llvm.org/D90328



More information about the llvm-commits mailing list