ahatanak added a comment.

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:

  { // This is the previous lexical scope.
  label1:
    ...
    int a; // We want to move the lifetime.start for "a" to the beginning of 
this scope (not the current lexical scope), since goto is not leaving its scope.
    ...
    { // This is the current lexical scope.
      int b; // We don't want to move the lifetime.start for "b", since goto is 
leaving its scope.
      goto label1;
    }
  }

Currently, the lifetime.start is inserted at the beginning of the basic block 
of the lexical scope holding the goto's destination.

Let me know if I misunderstood your comment or you've found a flaw in this 
approach.


https://reviews.llvm.org/D27680



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to