[PATCH] D107513: [MemCpyOpt/MemorySSA] Do not run the pass for prohibitively large number of memory accesses.

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 7 13:53:37 PDT 2021


nikic added a comment.

In D107513#2930489 <https://reviews.llvm.org/D107513#2930489>, @asbirlea wrote:

> This is not related to optimized uses.
> The issue is when making a change in the IR, in this case inserting a memset. This triggers updating all the accesses found below that access. The renaming phase will traverse all the accesses in a block (see `MemorySSA::renameBlock`).

Just looked at the MemorySSA update code for the first time, and this is a lot more complicated than I expected...

I do wonder if we can't make the updating for the problematic case more efficient though. What we're doing here is less introducing a new def and more merging a number of defs into one -- any uses of those defs should point to the new def. In terms of the existing API surface, rather than inserting the new memset def after the existing store defs with RenameUses=true, can we instead insert it before the existing defs with RenameUses=false? The actual "renaming" would happen when the store memory accesses are removed, but that should be efficient and avoid any full block scans.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107513



More information about the llvm-commits mailing list