]> granicus.if.org Git - clang/commit
[CodeGen] Eagerly emit lifetime.end markers for calls
authorGeorge Burgess IV <george.burgess.iv@gmail.com>
Sat, 10 Mar 2018 23:06:31 +0000 (23:06 +0000)
committerGeorge Burgess IV <george.burgess.iv@gmail.com>
Sat, 10 Mar 2018 23:06:31 +0000 (23:06 +0000)
commitc28eb6d02c5cedd40b02aa7c496f13a71763312e
treee65f4188d1013462d44edc34aee8026400b756fe
parenta4a75f6417166ff8d689a41c26a68b9c979e8e42
[CodeGen] Eagerly emit lifetime.end markers for calls

In C, we'll wait until the end of the scope to clean up aggregate
temporaries used for returns from calls. This means in cases like:

{
  // Assuming that `Bar` is large enough to warrant indirect returns
  struct Bar b = {};
  b = foo(&b);
  b = foo(&b);
  b = foo(&b);
  b = foo(&b);
}

...We'll allocate space for 5 Bars on the stack (`b`, and 4
temporaries). This becomes painful in things like large switch
statements.

If cleaning up sooner is trivial, we should do it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@327229 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CGExprAgg.cpp
test/CodeGen/aggregate-assign-call.c [new file with mode: 0644]