[llvm] [SROA] Use SetVector for PromotableAllocas (PR #105809)

Bartłomiej Chmiel via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 4 03:39:09 PDT 2024


b-chmiel wrote:

Thanks, this fully addresses my issue with SROA scalability. In my case the number of elements is so large (~0.5 billion elements) that any operation on `PromotableAllocas` is a bottleneck, so optimizing removal from O(n^2) to O(nlog2n) makes compilation feasible.

Still, `PromoteMemToReg` is a bottleneck and compilation consumes a lot of operational memory (>100G), but for now I'll focus on optimizing code generation on the Verilator side.

In the common case, when elements fit in a vector, the duration of this phase is negligible and there is no noticeable difference between `PromotableAllocas` representations. I'd set small factor to 16 (similarly to other structures there) to stop Set-operation constant factors from affecting performance in the typical case.

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


More information about the llvm-commits mailing list