[llvm] [MemCpyOpt] Continue merging memset with unrelated clobber (PR #89550)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 23 17:58:58 PDT 2024


nikic wrote:

> > Yes, the compile-time impact here looks basically reasonable to me. My only concern would be that this may further exacerbate the pre-existing problem with quadratic run-time we have in this function by lengthening the scan it performs.
> 
> Do you think we should add a threshold as "dse-memoryssa-scanlimit" in DSE?

That shouldn't be necessary, we just need to implement it in a way that is non quadratic. The problem is that when we see a store, we scan forward to find mergeable stores. And if this is a very long store sequence that ultimately cannot be merged, then we'll do the same scan from the second store, and then again from the third etc. But this is pointless. This transform should require visiting each store only once.

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


More information about the llvm-commits mailing list