[PATCH] D27680: [CodeGen] Move lifetime.start of a variable when goto jumps back past its declaration

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 22 19:29:01 PST 2016


rjmccall added a comment.

In https://reviews.llvm.org/D27680#629182, @ahatanak wrote:

> In https://reviews.llvm.org/D27680#628272, @rjmccall wrote:
>
> > Wouldn't it be simpler to just record an insertion point for the beginning of the current lexical scope and insert the lifetime.begin there instead of at the current IP?
>
>
> I'm not sure I understood your comment, but it seems to me that simply moving the lifetime.start intrinsics to the current lexical scope wouldn't work in a case like this:


I'm suggesting that, instead of moving instructions retroactively when you see a goto, you just insert the lifetime.start intrinsics at the start of the current lexical scope when you're emitting the variable.  That more exactly models the C language rule, I think, and shouldn't have any significant negative impact on optimization.


https://reviews.llvm.org/D27680





More information about the cfe-commits mailing list