summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2018-09-07 21:24:27 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2018-09-07 21:24:27 +0000
commitedb9fbb78a18d796e497e83ff912b19d064cf5a1 (patch)
tree9cd20a4bb5a38c68523bee758bfa7603e0a90e15 /clang/lib/CodeGen
parentf98c2c5e6d65fb2a0194fd3ea9f52d793035f63c (diff)
downloadbcm5719-llvm-edb9fbb78a18d796e497e83ff912b19d064cf5a1.tar.gz
bcm5719-llvm-edb9fbb78a18d796e497e83ff912b19d064cf5a1.zip
Make -Watomic-alignment say whether the atomic operation was oversized
or misaligned. llvm-svn: 341710
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGAtomic.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CGAtomic.cpp b/clang/lib/CodeGen/CGAtomic.cpp
index eaf29dfff29..5b63b3ffca9 100644
--- a/clang/lib/CodeGen/CGAtomic.cpp
+++ b/clang/lib/CodeGen/CGAtomic.cpp
@@ -765,11 +765,15 @@ RValue CodeGenFunction::EmitAtomicExpr(AtomicExpr *E) {
std::tie(sizeChars, alignChars) = getContext().getTypeInfoInChars(AtomicTy);
uint64_t Size = sizeChars.getQuantity();
unsigned MaxInlineWidthInBits = getTarget().getMaxAtomicInlineWidth();
- bool UseLibcall = ((Ptr.getAlignment() % sizeChars) != 0 ||
- getContext().toBits(sizeChars) > MaxInlineWidthInBits);
- if (UseLibcall)
- CGM.getDiags().Report(E->getBeginLoc(), diag::warn_atomic_op_misaligned);
+ bool Oversized = getContext().toBits(sizeChars) > MaxInlineWidthInBits;
+ bool Misaligned = (Ptr.getAlignment() % sizeChars) != 0;
+ bool UseLibcall = Misaligned | Oversized;
+
+ if (UseLibcall) {
+ CGM.getDiags().Report(E->getBeginLoc(), diag::warn_atomic_op_misaligned)
+ << !Oversized;
+ }
llvm::Value *Order = EmitScalarExpr(E->getOrder());
llvm::Value *Scope =
OpenPOWER on IntegriCloud