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

Akira Hatanaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 23 14:03:37 PST 2016


ahatanak updated this revision to Diff 82421.
ahatanak added a comment.

When compiling for C, insert lifetime.start at the beginning of the current lexical scope, rather than moving it retroactively when a goto jumps backwards over the variable declaration.

Also, insert lifetime.start at a more precise location, rather than always inserting it at the beginning of a basic block. This enables keeping the live ranges disjoint in some cases. For example, in the following code, the live ranges of a and b would overlap if the lifetime.starts were moved to the beginning of the basic block, but would be disjoint if moved to the beginning of their lexical scopes:

void foo1() {

  {
    int a[5];
    foo2(a);
  }
  {
    int b[5];
    foo2(b);
  }

}


https://reviews.llvm.org/D27680

Files:
  lib/CodeGen/CGDecl.cpp
  lib/CodeGen/CodeGenFunction.h
  test/CodeGen/cleanup-destslot-simple.c
  test/CodeGen/lifetime2.c
  test/CodeGenObjC/arc-blocks.m
  test/CodeGenObjC/arc-bridged-cast.m
  test/CodeGenObjC/arc-precise-lifetime.m
  test/CodeGenObjC/arc-ternary-op.m
  test/CodeGenObjC/arc.m

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27680.82421.patch
Type: text/x-patch
Size: 23782 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161223/418febb4/attachment-0001.bin>


More information about the cfe-commits mailing list