[PATCH] D109749: Experimental Partial Mem2Reg

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 21 08:32:16 PDT 2021


jdoerfert added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp:634
+        PreCaptureUsers.push_back(I);
+    }
+
----------------
I doubt this logic works in loops.

```
H: 
   I = use(alloca);
C: store alloca into mem
if (...) goto H;
```

Capture (C) post dominates the user (I) but it is executed *after* and *before* the use, just not in the same iteration of the loop defined by H.

Once the alloca is captured you cannot judge anymore without a lot more analysis (incl. nosync). To salvage this, reachability, not post-dominaince, is what you are looking for.

All that said, I still believe the problem at hand should be solved by marking the reduction thing as not capturing.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109749



More information about the llvm-commits mailing list