This patch fixes a bug in IRGen where it wasn't calling the destructors to destruct compound literals.
I've split out the changes needed to emit destructor calls for non-trivial C structs returned by function calls and loaded from volatile objects (https://reviews.llvm.org/D66094).
rdar://problem/51867864
Unfortunately, the lifetime of compound literals in C is not this simple; they're like blocks in that they're destroyed at the end of the enclosing scope rather than at the end of the current statement. (The cleanup here will be popped at the end of the full-expression if we've entered an ExprWithCleanups.) And the l-value case is exactly the case where this matters.
I think you need to do something like what we do with blocks, where we record all the blocks in the full-expression on the ExprWithCleanups so that we can push an inactive cleanup for them and then activate it when we emit the block.