Merging r257902 (and r257775)
authorHans Wennborg <hans@hanshq.net>
Tue, 19 Jan 2016 18:26:37 +0000 (18:26 +0000)
committerHans Wennborg <hans@hanshq.net>
Tue, 19 Jan 2016 18:26:37 +0000 (18:26 +0000)
commitaa96fb86c3304e81c2f53700223d0e795c302276
tree547563341bc5a458f27ef6a3f2f48aecac21122f
parented504bedd7420790d55e441e35e5449eaa40029e
Merging r257902 (and r257775)

------------------------------------------------------------------------
r257775 | jyknight | 2016-01-14 08:33:21 -0800 (Thu, 14 Jan 2016) | 3 lines

Revert "Stop increasing alignment of externally-visible globals on ELF platforms."

This reverts commit r257719, due to PR26144.
------------------------------------------------------------------------

------------------------------------------------------------------------
r257902 | jyknight | 2016-01-15 08:33:06 -0800 (Fri, 15 Jan 2016) | 17 lines

Stop increasing alignment of externally-visible globals on ELF
platforms.

With ELF, the alignment of a global variable in a shared library will
get copied into an executables linked against it, if the executable even
accesss the variable. So, it's not possible to implicitly increase
alignment based on access patterns, or you'll break existing binaries.

This happened to affect libc++'s std::cout symbol, for example. See
thread: http://thread.gmane.org/gmane.comp.compilers.clang.devel/45311

(This is a re-commit of r257719, without the bug reported in
PR26144. I've tweaked the code to not assert-fail in
enforceKnownAlignment when computeKnownBits doesn't recurse far enough
to find the underlying Alloca/GlobalObject value.)

Differential Revision: http://reviews.llvm.org/D16145
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_38@258155 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/IR/GlobalValue.h
lib/CodeGen/CodeGenPrepare.cpp
lib/IR/Globals.cpp
lib/Transforms/Utils/Local.cpp
test/CodeGen/ARM/memfunc.ll