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