[PATCH] D13874: Atomics: support __c11_* calls on _Atomic struct types
Tim Northover via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 19 14:05:35 PDT 2015
t.p.northover created this revision.
t.p.northover added a subscriber: cfe-commits.
t.p.northover set the repository for this revision to rL LLVM.
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.
It also tidies up that function a little: previously there was a confusing dual-return situation, where sometimes the result was returned as an RValue, other times stored into a user-provided destination. I don't think this is necessary (it dates back from the very beginning of CGAtomic.cpp).
Repository:
rL LLVM
http://reviews.llvm.org/D13874
Files:
lib/CodeGen/CGAtomic.cpp
lib/CodeGen/CGExprAgg.cpp
lib/CodeGen/CodeGenFunction.h
test/CodeGen/atomic-arm64.c
test/CodeGen/atomic-ops.c
test/CodeGen/c11atomics-ios.c
test/CodeGen/c11atomics.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13874.37791.patch
Type: text/x-patch
Size: 31403 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151019/033b23c2/attachment-0001.bin>
More information about the cfe-commits
mailing list