svn commit: r412196 - in head/devel/llvm37: . files
Brooks Davis
brooks at FreeBSD.org
Wed Mar 30 21:23:20 UTC 2016
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 <bsd.port.post.mk>
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 <class Compare>
+ 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 <class Compare>
+-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...
+ //
More information about the svn-ports-all
mailing list