From owner-svn-src-head@freebsd.org Fri Oct 9 18:21:47 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2D3119D284C; Fri, 9 Oct 2015 18:21:47 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CED453DD; Fri, 9 Oct 2015 18:21:46 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t99ILjYj054213; Fri, 9 Oct 2015 18:21:45 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t99ILjHI054211; Fri, 9 Oct 2015 18:21:45 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201510091821.t99ILjHI054211@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 9 Oct 2015 18:21:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r289072 - in head/contrib: libc++/src llvm/lib/Transforms/Vectorize X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Oct 2015 18:21:47 -0000 Author: dim Date: Fri Oct 9 18:21:45 2015 New Revision: 289072 URL: https://svnweb.freebsd.org/changeset/base/289072 Log: 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. Modified: head/contrib/libc++/src/iostream.cpp head/contrib/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp Modified: head/contrib/libc++/src/iostream.cpp ============================================================================== --- head/contrib/libc++/src/iostream.cpp Fri Oct 9 17:46:05 2015 (r289071) +++ head/contrib/libc++/src/iostream.cpp Fri Oct 9 18:21:45 2015 (r289072) @@ -86,3 +86,4 @@ ios_base::Init::~Init() } _LIBCPP_END_NAMESPACE_STD + Modified: head/contrib/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp ============================================================================== --- head/contrib/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp Fri Oct 9 17:46:05 2015 (r289071) +++ head/contrib/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp Fri Oct 9 18:21:45 2015 (r289072) @@ -1642,10 +1642,8 @@ bool BoUpSLP::isFullyVectorizableTinyTre 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.