fix memcpy/memset/memmove lowering when optimizing for size
authorSanjay Patel <spatel@rotateright.com>
Thu, 30 Jul 2015 21:41:50 +0000 (21:41 +0000)
committerSanjay Patel <spatel@rotateright.com>
Thu, 30 Jul 2015 21:41:50 +0000 (21:41 +0000)
commit8a6197a968c91aca5b793718072ef3886c2cadd8
tree73467f0eb9ca552e6007c72ed48dd33540d720a4
parentdd6dcb6cee3ceee34522020632738e3322fb6b50
fix memcpy/memset/memmove lowering when optimizing for size

Fixing MinSize attribute handling was discussed in D11363.
This is a prerequisite patch to doing that.

The handling of OptSize when lowering mem* functions was broken
on Darwin because it wants to ignore -Os for these cases, but the
existing logic also made it ignore -Oz (MinSize).

The Linux change demonstrates a widespread problem. The backend
doesn't usually recognize the MinSize attribute by itself; it
assumes that if the MinSize attribute exists, then the OptSize
attribute must also exist.

Fixing this more generally will be a follow-on patch or two.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243693 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
lib/Target/ARM/ARMISelLowering.cpp
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/memcpy.ll