[PATCH] D43269: [MemorySSA] Be less aggressive with @llvm.lifetime.start

Nuno Lopes via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 18 14:54:14 PST 2018


nlopes added a comment.

Thanks @dberlin and @george.burgess.iv. I wasn't aware of this issue.

Sometime ago we were thinking along these lines:

- change alloca to do lifetime.start by default -- just like now
- add a bit to alloca to specify that lifetime didn't start yet.  (the current semantics is weird; we need to see the future to decide whether alloca is valid or not)
- make lifetime.start return the input pointer, but now valid.

e.g.:
%a = alloca i32, invalid
%p = call @lifetime.start %a
load %p  ; OK
load %a  ; not OK; invalid pointer

call @lifetime.end %p
load %p ; invalid

I think in this model it's possible to support multiple starts because they return a pointer that is valid until end.  Didn't think much about that because I wasn't aware of the need.
While this scheme makes start more memory SSA-like, it still leaves lifetime.end having implicit side-effects. But it's a start, at least.


Repository:
  rL LLVM

https://reviews.llvm.org/D43269





More information about the llvm-commits mailing list