[llvm] [DeadStoreElimination] Visit blocks in RPO traversal when initializing DSEState (PR #137815)

Antonio Frighetto via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 30 03:33:17 PDT 2025


antoniofrighetto wrote:

> Isn't this also going to invert the order for other places iterating MemDeps?

Right, I believe this should be fine as long as dominance checks are preserved? Mostly seems used to take into account MemoryPhis.

> Generally it makes sense to me to have consistent block and instruction iteration order (i.e. either use PO + reverse(BB) or RPO + BB), but I don't think this change is right by itself.
>
> It's also not really clear to me what the actual issue you are trying to fix is. You are testing debug output, but does this also make a difference on optimization behavior?

I expected last defs to be processed first while envisioning support elimination of dead stores in loop-carried dependencies at the end of functions, and early bail-out from loops if cannot delete such stores. Though, I think this won't make a difference for now due to how the elimination loop works, so, admittedly, this might not be strictly necessary...

https://github.com/llvm/llvm-project/pull/137815


More information about the llvm-commits mailing list