[PATCH] D93376: [LangRef] Clarify the semantics of lifetime intrinsics

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 17 16:16:42 PST 2020


efriedma added a comment.

In D93376#2461296 <https://reviews.llvm.org/D93376#2461296>, @jdoerfert wrote:

>> To summarize, I think we should restrict these intrinsics to alloca'ed ptrs for now as LLVM doesn't support anything else. If in the future someone extends them to support other kind of objects, then the semantics can be updated.
>
> I'm still missing the why beyond: "Because some passes don't want to check `isa<AllocaInst>(V->stripPointerCasts())` before using the lifetime marker".

We need to support performing stack coloring consistently.  Completely skipping coloring for a large function is a big performance hit.  We need LLVM IR intrinsics that support this.  Given that, we have two options:

1. We restrict llvm.lifetime.start/end so a random llvm.lifetime intrinsic can't completely disable the stack coloring pass.  I think this means `isa<AllocaInst>(V->stripPointerCasts())` must always be true; otherwise, I'm not sure how you would figure out the points in the function where a given alloca is live.
2. We give up on the existing lifetime intrinsics and introduce new ones which do allow consistent stack coloring.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93376/new/

https://reviews.llvm.org/D93376



More information about the llvm-commits mailing list