[llvm] [GlobalOpt] Prevent widenDestArray from shrinking an alloca. (PR #144641)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 18 01:24:13 PDT 2025


https://github.com/nikic requested changes to this pull request.

The current implementation is also wrong in the case where one of the memcpys previously copied less than the full size of the global. It gets changes to copy the new size, which is larger and may overwrite other memory.

I believe you need to replicate all the checks from this condition (which is currently only checked for a single alloca, instead of all of them): https://github.com/llvm/llvm-project/blob/4f5b59fad54e891c09c129e99fe82a921eed6432/llvm/lib/Transforms/IPO/GlobalOpt.cpp#L2185-L2189

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


More information about the llvm-commits mailing list