summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExprAgg.cpp
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2015-11-09 19:56:35 +0000
committerTim Northover <tnorthover@apple.com>2015-11-09 19:56:35 +0000
commitcc2a6e0608738498cf4e677baf8566460c7083b4 (patch)
tree982693aaff11a52f1e880f0c585554781d740391 /clang/lib/CodeGen/CGExprAgg.cpp
parent9c76869bc33c25d07d5b4ed3eacf310e3f3537cb (diff)
downloadbcm5719-llvm-cc2a6e0608738498cf4e677baf8566460c7083b4.tar.gz
bcm5719-llvm-cc2a6e0608738498cf4e677baf8566460c7083b4.zip
Atomics: support __c11_* calls on _Atomic struct types.
When a struct's size is not a power of 2, the corresponding _Atomic() type is promoted to the nearest. We already correctly handled normal C++ expressions of this form, but direct calls to the __c11_atomic_whatever builtins ended up performing dodgy operations on the smaller non-atomic types (e.g. memcpy too much). Later optimisations removed this as undefined behaviour. This patch converts EmitAtomicExpr to allocate its temporaries at the full atomic width, sidestepping the issue. llvm-svn: 252507
Diffstat (limited to 'clang/lib/CodeGen/CGExprAgg.cpp')
-rw-r--r--clang/lib/CodeGen/CGExprAgg.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp
index 906ffa4fb54..20838db044c 100644
--- a/clang/lib/CodeGen/CGExprAgg.cpp
+++ b/clang/lib/CodeGen/CGExprAgg.cpp
@@ -199,7 +199,8 @@ public:
// case Expr::ChooseExprClass:
void VisitCXXThrowExpr(const CXXThrowExpr *E) { CGF.EmitCXXThrowExpr(E); }
void VisitAtomicExpr(AtomicExpr *E) {
- CGF.EmitAtomicExpr(E, EnsureSlot(E->getType()).getAddress());
+ RValue Res = CGF.EmitAtomicExpr(E);
+ EmitFinalDestCopy(E->getType(), Res);
}
};
} // end anonymous namespace.
OpenPOWER on IntegriCloud