[PATCH] D18196: [CodeGen] Emit lifetime.end intrinsic after destructor call in landing pad
Akira Hatanaka via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 15 14:38:39 PDT 2016
ahatanak created this revision.
ahatanak added reviewers: rnk, rjmccall.
ahatanak added a subscriber: cfe-commits.
This patch fixes a bug in CodeGen where lifetime.end intrinsics were not being inserted after destructor calls in landing pad blocks, which prevented StackColoring from merging stack slots for allocas because it couldn't tell their lifetime ranges were disjoint.
This patch changes the code in CodeGenFunction::EmitAutoVarCleanup to pass NormalAndEHCleanup instead of NormalCleanup to EHScopeStack::pushCleanup so that CallLifetimeEnd runs the cleanup code when a scope is exited using exceptional control flow too. I initially considered adding code to DestroyObject::Emit to emit lifetime.end after the destructor call, but letting CallLifetimeEnd emit lifetime.end seemed like a better approach.
This is the link to the discussion on llvm-dev:
http://lists.llvm.org/pipermail/llvm-dev/2016-March/096233.html
http://reviews.llvm.org/D18196
Files:
lib/CodeGen/CGCleanup.cpp
lib/CodeGen/CGDecl.cpp
lib/CodeGen/EHScopeStack.h
test/CodeGenCXX/destructors.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18196.50766.patch
Type: text/x-patch
Size: 4734 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160315/e23aef71/attachment.bin>
More information about the cfe-commits
mailing list