Reinstall the patch "Use EmitPointerWithAlignment to get alignment information of...
authorWei Mi <wmi@google.com>
Mon, 25 Sep 2017 19:57:59 +0000 (19:57 +0000)
committerWei Mi <wmi@google.com>
Mon, 25 Sep 2017 19:57:59 +0000 (19:57 +0000)
commit01414bdc2c23f24e255d4b068f90938035f1149a
tree07136b7ecd332ea7a1b32c19d101db92ae2cfed1
parent1acd2cf15ac950a323014545e2b4f1cf564109d6
Reinstall the patch "Use EmitPointerWithAlignment to get alignment information of the pointer used in atomic expr" after fixing PR31620.

This is to fix PR34347. EmitAtomicExpr now only uses alignment information from
Type, instead of Decl, so when the declaration of an atomic variable is marked
to have the alignment equal as its size, EmitAtomicExpr doesn't know about it and
will generate libcall instead of atomic op. The patch uses EmitPointerWithAlignment
to get the precise alignment information.

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

llvm-svn: 314145
clang/lib/CodeGen/CGAtomic.cpp
clang/test/CodeGenCXX/atomic-align.cpp [new file with mode: 0644]