[llvm] [IR] Only allow lifetime.start/end on allocas (PR #149310)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 17 12:51:30 PDT 2025


nikic wrote:

> Generally, it makes sense to me. I also thought about this last year: [dtcxzyw/llvm-tools at c5ce24a](https://github.com/dtcxzyw/llvm-tools/commit/c5ce24aab4a5336e33db8bdffecde451e87ad602)
> 
> Unfortunately, the code reminds me that lifetime markers are also used on `sret` arguments: https://github.com/dtcxzyw/llvm-opt-benchmark/blob/bd68fbece73af02012173822192d3b4ff72df08c/bench/minetest/original/guiButton.ll#L4478

Hm, I've not encountered this on any clang tests or in llvm-test-suite. I wonder whether this is an older issue that has since been fixed?

> BTW, does the order of lifetime markers matter? I mean the start-end sequence should look like a balanced bracket sequence. See also https://github.com/dtcxzyw/llvm-project/pull/2/files#diff-afb2b04eff951cb67d214bc6dfa62a087a72591451817dba7929b48c5fe635f9.

I don't think it matters right now as long as the interference graph is preserved. We'd want this property though for a more intrusive redesign of lifetime intrinsics, along the lines of what is discussed in https://github.com/llvm/llvm-project/issues/45725.

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


More information about the llvm-commits mailing list