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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 18 02:48:38 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?

Looking a bit closer, it looks like even though this is in the `original` directory, this is actually optimized IR. Possibly this pattern was introduced by some optimization. Here is the original IR I get with current clang with the file at the same commit: https://gist.github.com/nikic/e1c3991f42cd64f1817e3cf7a9ee283a It does not have lifetime.start on sret (before or after optimization).

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


More information about the llvm-commits mailing list