[llvm] [MemCpyOpt] fix incorrect handling of lifetime markers (PR #143782)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 12 03:18:44 PDT 2025


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

In practice, all lifetime markers should have an alloca argument and a size matching the alloca and be handled by the "whole alloca" code path that is independent of the passed size. In theory, lifetimes can be used in other ways, but this is the only practically relevant case. If I ever find the time, I'll drop the size argument from these intrinsics.

I do see some diffs from this change on https://github.com/dtcxzyw/llvm-opt-benchmark/pull/2428, but I'm having a hard time understanding where they are actually coming from. None of the cases I looked at have mismatched lifetimes.

I think what actually happens is that your new implementation of hadUndefContentsBefore does not bail out if none of the cases match, which means that it will just continue the walk from the last found clobber -- which can only improve things if the clobber was the result of hitting the MSSA walk limit, rather than an actual clobber. So effectively, all this patch is really doing is add a bypass for the walk limit.

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


More information about the llvm-commits mailing list