]> granicus.if.org Git - clang/commit
CodeGen: Don't completely mess-up optimized atomic libcalls
authorDavid Majnemer <david.majnemer@gmail.com>
Fri, 29 Aug 2014 07:27:49 +0000 (07:27 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Fri, 29 Aug 2014 07:27:49 +0000 (07:27 +0000)
commit5630e0fe4f6dc34f6118eb593667dd755deb5a8e
tree6304ae38331cf2a18c8a0dcb393deb53b154c9a7
parentf11dfe02ad387ab7421599c1a008a36977866bcc
CodeGen: Don't completely mess-up optimized atomic libcalls

Summary:
We did a great job getting this wrong:
- We messed up which LLVM IR types to use for arguments and return values.
  The optimized libcalls use integer types for values.

  Clang attempted to use the IR type which corresponds to the value
  passed in instead of using an appropriately sized integer type.  This
  would result in violations of the ABI for, as an example, floating
  point types.
- We didn't bother recording the result of the atomic libcall in the
  destination memory.

Instead, call the functions with arguments matching the type of the
libcall prototype's parameters.

This fixes PR20780.

Differential Revision: http://reviews.llvm.org/D5098

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216714 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CGAtomic.cpp
test/CodeGen/atomic-ops-libcall.c
test/CodeGen/atomic-ops.c