Temporarily revert upstream llvm trunk r240144 (by Michael Zolotukhin):

[SLP] Vectorize for all-constant entries.

This should fix libc++'s iostream initialization SIGBUSing on amd64,
whenever the global cout symbol is not aligned to 16 bytes.

Some further explanation: libc++'s iostream.cpp contains the definitions
of std::cout, std::cerr and so on.  These global objects are effectively
declared with an alignment of 8 bytes.  When an executable is linked
against libc++.so, it can sometimes get a copy of the global object,
which is then at the same alignment.

However, with clang 3.7.0, the initialization of these global objects
will incorrectly use SSE instructions (e.g. movdqa), whenever the
optimization level is high enough, and SSE is enabled, such as on amd64.
When any of these objects is not aligned to 16 bytes, this will result
in a SIGBUS during iostream initialization.  In contrast, clang 3.6.x
and earlier took the 8 byte alignment into consideration, and avoided
SSE for those particular operations.

After bisecting of upstream changes, I found that the above revision
caused the change of this behavior, so I am reverting it now as a
workaround, while a discussion and test case is being prepared for
upstream.
This commit is contained in:
Dimitry Andric 2015-10-09 18:21:45 +00:00
parent 656f49f8e2
commit d361766d4b
2 changed files with 3 additions and 4 deletions

View File

@ -86,3 +86,4 @@ ios_base::Init::~Init()
}
_LIBCPP_END_NAMESPACE_STD

View File

@ -1642,10 +1642,8 @@ bool BoUpSLP::isFullyVectorizableTinyTree() {
if (VectorizableTree.size() != 2)
return false;
// Handle splat and all-constants stores.
if (!VectorizableTree[0].NeedToGather &&
(allConstant(VectorizableTree[1].Scalars) ||
isSplat(VectorizableTree[1].Scalars)))
// Handle splat stores.
if (!VectorizableTree[0].NeedToGather && isSplat(VectorizableTree[1].Scalars))
return true;
// Gathering cost would be too much for tiny trees.