PR36992: do not store beyond the dsize of a class object unless we know
authorRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 5 Apr 2018 20:52:58 +0000 (20:52 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 5 Apr 2018 20:52:58 +0000 (20:52 +0000)
commite78fac5126cfab4c9bf35d3a478239b38825b17b
tree38f6360237fd9031ed0bbdae18629979e7774f5a
parentc233ae8004dfa6aa2c420fe16d15bc3f28ed4ac1
PR36992: do not store beyond the dsize of a class object unless we know
the tail padding is not reused.

We track on the AggValueSlot (and through a couple of other
initialization actions) whether we're dealing with an object that might
share its tail padding with some other object, so that we can avoid
emitting stores into the tail padding if that's the case. We still
widen stores into tail padding when we can do so.

Differential Revision: https://reviews.llvm.org/D45306

llvm-svn: 329342
16 files changed:
clang/lib/CodeGen/CGAtomic.cpp
clang/lib/CodeGen/CGBlocks.cpp
clang/lib/CodeGen/CGCall.cpp
clang/lib/CodeGen/CGClass.cpp
clang/lib/CodeGen/CGDecl.cpp
clang/lib/CodeGen/CGDeclCXX.cpp
clang/lib/CodeGen/CGExpr.cpp
clang/lib/CodeGen/CGExprAgg.cpp
clang/lib/CodeGen/CGExprCXX.cpp
clang/lib/CodeGen/CGObjC.cpp
clang/lib/CodeGen/CGOpenMPRuntime.cpp
clang/lib/CodeGen/CGStmt.cpp
clang/lib/CodeGen/CGValue.h
clang/lib/CodeGen/CodeGenFunction.h
clang/lib/CodeGen/ItaniumCXXABI.cpp
clang/test/CodeGenCXX/tail-padding.cpp [new file with mode: 0644]