From owner-svn-ports-all@freebsd.org Wed Mar 30 21:23:20 2016 Return-Path: Delivered-To: svn-ports-all@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 CDFD7AE3E68; Wed, 30 Mar 2016 21:23:20 +0000 (UTC) (envelope-from brooks@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 9A9781FFC; Wed, 30 Mar 2016 21:23:20 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u2ULNJgg006755; Wed, 30 Mar 2016 21:23:19 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u2ULNJa3006753; Wed, 30 Mar 2016 21:23:19 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201603302123.u2ULNJa3006753@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 30 Mar 2016 21:23:19 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r412196 - in head/devel/llvm37: . files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Mar 2016 21:23:20 -0000 Author: brooks Date: Wed Mar 30 21:23:19 2016 New Revision: 412196 URL: https://svnweb.freebsd.org/changeset/ports/412196 Log: Apply upstream llvm r243590 Koop Mast reported that on FreeBSD 10.1-R i386, devel/libclc gets a build error, when its 'prepare-builtins' segfaults. It turns out this is due to a stack overflow, when recursively sorting an internal list. Upstream, this was changed to an iterative operation, to prevent stack overflow in some cases, here: http://reviews.llvm.org/rL243590 ------------------------------------------------------------------------ r243590 | matze | 2015-07-30 01:22:48 +0200 (Thu, 30 Jul 2015) | 9 lines IR: Implement Value::mergeUseLists() iteratively This avoids stack overflows when the the compiler does not perform tail call elimination. Apparently this happens for MSVC with the /Ob2 switch which may be used by external code including this header. Reported by and based on a patch from Jean-Francois Riendeau. Related to rdar://21900756 ------------------------------------------------------------------------ I have verified this allows devel/libclc to build successfully on 10.1-R. PR: 208403 Submitted by: dim Added: head/devel/llvm37/files/patch-llvm-svn-243590 (contents, props changed) Modified: head/devel/llvm37/Makefile Modified: head/devel/llvm37/Makefile ============================================================================== --- head/devel/llvm37/Makefile Wed Mar 30 20:54:33 2016 (r412195) +++ head/devel/llvm37/Makefile Wed Mar 30 21:23:19 2016 (r412196) @@ -2,6 +2,7 @@ PORTNAME= llvm DISTVERSION= 3.7.1 +PORTREVISION= 1 CATEGORIES= devel lang MASTER_SITES= http://llvm.org/${PRE_}releases/${LLVM_RELEASE}/${RCDIR} DISTNAME= ${PORTNAME}-${DISTVERSION}.src @@ -426,5 +427,16 @@ svn-patch-lldb: svn diff -c ${PATCH_REV} ${_LLVM_BASE} | \ sed -E -e 's;^(---|\+\+\+) ;\1 tools/lldb/;' >> ${_PATCH_FILE} .endif +.if make(svn-patch-llvm) +.if !defined(PATCH_REV) +.error svn-patch-llvm requires that PATCH_REV be set +.endif +_PATCH_FILE=${FILESDIR}/patch-llvm-svn-${PATCH_REV} +_LLVM_BASE=http://llvm.org/svn/llvm-project/llvm/trunk +svn-patch-llvm: + svn log -c ${PATCH_REV} ${_LLVM_BASE} >> ${_PATCH_FILE} + svn diff -c ${PATCH_REV} ${_LLVM_BASE} >> ${_PATCH_FILE} +.endif + .include Added: head/devel/llvm37/files/patch-llvm-svn-243590 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/llvm37/files/patch-llvm-svn-243590 Wed Mar 30 21:23:19 2016 (r412196) @@ -0,0 +1,73 @@ +------------------------------------------------------------------------ +r243590 | matze | 2015-07-29 23:22:48 +0000 (Wed, 29 Jul 2015) | 9 lines + +IR: Implement Value::mergeUseLists() iteratively + +This avoids stack overflows when the the compiler does not perform tail call +elimination. Apparently this happens for MSVC with the /Ob2 switch which +may be used by external code including this header. + +Reported by and based on a patch from Jean-Francois Riendeau. + +Related to rdar://21900756 +------------------------------------------------------------------------ +Index: include/llvm/IR/Value.h +=================================================================== +--- include/llvm/IR/Value.h (revision 243589) ++++ include/llvm/IR/Value.h (revision 243590) +@@ -493,7 +493,28 @@ + template + static Use *mergeUseLists(Use *L, Use *R, Compare Cmp) { + Use *Merged; +- mergeUseListsImpl(L, R, &Merged, Cmp); ++ Use **Next = &Merged; ++ ++ for (;;) { ++ if (!L) { ++ *Next = R; ++ break; ++ } ++ if (!R) { ++ *Next = L; ++ break; ++ } ++ if (Cmp(*R, *L)) { ++ *Next = R; ++ Next = &R->Next; ++ R = R->Next; ++ } else { ++ *Next = L; ++ Next = &L->Next; ++ L = L->Next; ++ } ++ } ++ + return Merged; + } + +@@ -586,25 +607,6 @@ + } + } + +-template +-void Value::mergeUseListsImpl(Use *L, Use *R, Use **Next, Compare Cmp) { +- if (!L) { +- *Next = R; +- return; +- } +- if (!R) { +- *Next = L; +- return; +- } +- if (Cmp(*R, *L)) { +- *Next = R; +- mergeUseListsImpl(L, R->Next, &R->Next, Cmp); +- return; +- } +- *Next = L; +- mergeUseListsImpl(L->Next, R, &L->Next, Cmp); +-} +- + // isa - Provide some specializations of isa so that we don't have to include + // the subtype header files to test to see if the value is a subclass... + //