summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/patches
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2015-12-25 21:39:45 +0000
committerdim <dim@FreeBSD.org>2015-12-25 21:39:45 +0000
commit6f44a590dad07c47cdc2fc19861574af1da36963 (patch)
tree3570671d3fc79afee8f95c67867446e3151a9d94 /contrib/llvm/patches
parent0efa1469be94566c09b9f4ce538c28e92d26026c (diff)
downloadFreeBSD-src-6f44a590dad07c47cdc2fc19861574af1da36963.zip
FreeBSD-src-6f44a590dad07c47cdc2fc19861574af1da36963.tar.gz
Upgrade our copies of clang and llvm to 3.7.1 release. This is a
bugfix-only release, with no new features. Please note that from 3.5.0 onwards, clang and llvm require C++11 support to build; see UPDATING for more information.
Diffstat (limited to 'contrib/llvm/patches')
-rw-r--r--contrib/llvm/patches/README.TXT8
-rw-r--r--contrib/llvm/patches/patch-08-clang-cc1as-dwarf2.diff (renamed from contrib/llvm/patches/patch-10-clang-cc1as-dwarf2.diff)0
-rw-r--r--contrib/llvm/patches/patch-08-llvm-r250085-fix-avx-crash.diff142
-rw-r--r--contrib/llvm/patches/patch-09-clang-r250657-openmp.diff182
4 files changed, 4 insertions, 328 deletions
diff --git a/contrib/llvm/patches/README.TXT b/contrib/llvm/patches/README.TXT
index 220baf0..96112b6 100644
--- a/contrib/llvm/patches/README.TXT
+++ b/contrib/llvm/patches/README.TXT
@@ -1,11 +1,11 @@
This is a set of individual patches, which contain all the customizations to
llvm/clang currently in the FreeBSD base system. These can be applied in
-alphabetical order to a pristine llvm/clang 3.7.0 source tree, for example by
+alphabetical order to a pristine llvm/clang 3.7.1 source tree, for example by
doing:
-svn co https://llvm.org/svn/llvm-project/llvm/trunk llvm-3.7.0
-svn co https://llvm.org/svn/llvm-project/cfe/trunk llvm-3.7.0/tools/clang
-cd llvm-3.7.0
+svn co https://llvm.org/svn/llvm-project/llvm/trunk llvm-3.7.1
+svn co https://llvm.org/svn/llvm-project/cfe/trunk llvm-3.7.1/tools/clang
+cd llvm-3.7.1
for p in /usr/src/contrib/llvm/patches/patch-*.diff; do
patch -p0 -f -F0 -E -i $p -s || break
done
diff --git a/contrib/llvm/patches/patch-10-clang-cc1as-dwarf2.diff b/contrib/llvm/patches/patch-08-clang-cc1as-dwarf2.diff
index eb00168..eb00168 100644
--- a/contrib/llvm/patches/patch-10-clang-cc1as-dwarf2.diff
+++ b/contrib/llvm/patches/patch-08-clang-cc1as-dwarf2.diff
diff --git a/contrib/llvm/patches/patch-08-llvm-r250085-fix-avx-crash.diff b/contrib/llvm/patches/patch-08-llvm-r250085-fix-avx-crash.diff
deleted file mode 100644
index a83c68e..0000000
--- a/contrib/llvm/patches/patch-08-llvm-r250085-fix-avx-crash.diff
+++ /dev/null
@@ -1,142 +0,0 @@
-Pull in r250085 from upstream llvm trunk (by Andrea Di Biagio):
-
- [x86] Fix wrong lowering of vsetcc nodes (PR25080).
-
- Function LowerVSETCC (in X86ISelLowering.cpp) worked under the wrong
- assumption that for non-AVX512 targets, the source type and destination type
- of a type-legalized setcc node were always the same type.
-
- This assumption was unfortunately incorrect; the type legalizer is not always
- able to promote the return type of a setcc to the same type as the first
- operand of a setcc.
-
- In the case of a vsetcc node, the legalizer firstly checks if the first input
- operand has a legal type. If so, then it promotes the return type of the vsetcc
- to that same type. Otherwise, the return type is promoted to the 'next legal
- type', which, for vectors of MVT::i1 is always a 128-bit integer vector type.
-
- Example (-mattr=+avx):
-
- %0 = trunc <8 x i32> %a to <8 x i23>
- %1 = icmp eq <8 x i23> %0, zeroinitializer
-
- The initial selection dag for the code above is:
-
- v8i1 = setcc t5, t7, seteq:ch
- t5: v8i23 = truncate t2
- t2: v8i32,ch = CopyFromReg t0, Register:v8i32 %vreg1
- t7: v8i32 = build_vector of all zeroes.
-
- The type legalizer would firstly check if 't5' has a legal type. If so, then it
- would reuse that same type to promote the return type of the setcc node.
- Unfortunately 't5' is of illegal type v8i23, and therefore it cannot be used to
- promote the return type of the setcc node. Consequently, the setcc return type
- is promoted to v8i16. Later on, 't5' is promoted to v8i32 thus leading to the
- following dag node:
- v8i16 = setcc t32, t25, seteq:ch
-
- where t32 and t25 are now values of type v8i32.
-
- Before this patch, function LowerVSETCC would have wrongly expanded the setcc
- to a single X86ISD::PCMPEQ. Surprisingly, ISel was still able to match an
- instruction. In our case, ISel would have matched a VPCMPEQWrr:
- t37: v8i16 = X86ISD::VPCMPEQWrr t36, t25
-
- However, t36 and t25 are both VR256, while the result type is instead of class
- VR128. This inconsistency ended up causing the insertion of COPY instructions
- like this:
- %vreg7<def> = COPY %vreg3; VR128:%vreg7 VR256:%vreg3
-
- Which is an invalid full copy (not a sub register copy).
- Eventually, the backend would have hit an UNREACHABLE "Cannot emit physreg copy
- instruction" in the attempt to expand the malformed pseudo COPY instructions.
-
- This patch fixes the problem adding the missing logic in LowerVSETCC to handle
- the corner case of a setcc with 128-bit return type and 256-bit operand type.
-
- This problem was originally reported by Dimitry as PR25080. It has been latent
- for a very long time. I have added the minimal reproducible from that bugzilla
- as test setcc-lowering.ll.
-
- Differential Revision: http://reviews.llvm.org/D13660
-
-This should fix the "Cannot emit physreg copy instruction" errors when
-compiling contrib/wpa/src/common/ieee802_11_common.c, and CPUTYPE is set
-to a CPU supporting AVX (e.g. sandybridge, ivybridge).
-
-Introduced here: http://svnweb.freebsd.org/changeset/base/289221
-
-Index: lib/Target/X86/X86ISelLowering.cpp
-===================================================================
---- lib/Target/X86/X86ISelLowering.cpp
-+++ lib/Target/X86/X86ISelLowering.cpp
-@@ -13573,6 +13573,35 @@ static SDValue LowerVSETCC(SDValue Op, const X86Su
- DAG.getConstant(SSECC, dl, MVT::i8));
- }
-
-+ MVT VTOp0 = Op0.getSimpleValueType();
-+ assert(VTOp0 == Op1.getSimpleValueType() &&
-+ "Expected operands with same type!");
-+ assert(VT.getVectorNumElements() == VTOp0.getVectorNumElements() &&
-+ "Invalid number of packed elements for source and destination!");
-+
-+ if (VT.is128BitVector() && VTOp0.is256BitVector()) {
-+ // On non-AVX512 targets, a vector of MVT::i1 is promoted by the type
-+ // legalizer to a wider vector type. In the case of 'vsetcc' nodes, the
-+ // legalizer firstly checks if the first operand in input to the setcc has
-+ // a legal type. If so, then it promotes the return type to that same type.
-+ // Otherwise, the return type is promoted to the 'next legal type' which,
-+ // for a vector of MVT::i1 is always a 128-bit integer vector type.
-+ //
-+ // We reach this code only if the following two conditions are met:
-+ // 1. Both return type and operand type have been promoted to wider types
-+ // by the type legalizer.
-+ // 2. The original operand type has been promoted to a 256-bit vector.
-+ //
-+ // Note that condition 2. only applies for AVX targets.
-+ SDValue NewOp = DAG.getSetCC(dl, VTOp0, Op0, Op1, SetCCOpcode);
-+ return DAG.getZExtOrTrunc(NewOp, dl, VT);
-+ }
-+
-+ // The non-AVX512 code below works under the assumption that source and
-+ // destination types are the same.
-+ assert((Subtarget->hasAVX512() || (VT == VTOp0)) &&
-+ "Value types for source and destination must be the same!");
-+
- // Break 256-bit integer vector compare into smaller ones.
- if (VT.is256BitVector() && !Subtarget->hasInt256())
- return Lower256IntVSETCC(Op, DAG);
-Index: test/CodeGen/X86/setcc-lowering.ll
-===================================================================
---- test/CodeGen/X86/setcc-lowering.ll
-+++ test/CodeGen/X86/setcc-lowering.ll
-@@ -0,0 +1,29 @@
-+; RUN: llc -mtriple=x86_64-unknown-unknown -mattr=+avx < %s | FileCheck %s
-+
-+; Verify that we don't crash during codegen due to a wrong lowering
-+; of a setcc node with illegal operand types and return type.
-+
-+define <8 x i16> @pr25080(<8 x i32> %a) {
-+; CHECK-LABEL: pr25080:
-+; CHECK: # BB#0: # %entry
-+; CHECK-NEXT: vandps {{.*}}(%rip), %ymm0, %ymm0
-+; CHECK-NEXT: vextractf128 $1, %ymm0, %xmm1
-+; CHECK-NEXT: vpxor %xmm2, %xmm2, %xmm2
-+; CHECK-NEXT: vpcmpeqd %xmm2, %xmm1, %xmm1
-+; CHECK-NEXT: vmovdqa {{.*#+}} xmm3 = [0,1,4,5,8,9,12,13,8,9,12,13,12,13,14,15]
-+; CHECK-NEXT: vpshufb %xmm3, %xmm1, %xmm1
-+; CHECK-NEXT: vpcmpeqd %xmm2, %xmm0, %xmm0
-+; CHECK-NEXT: vpshufb %xmm3, %xmm0, %xmm0
-+; CHECK-NEXT: vpunpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm1[0]
-+; CHECK-NEXT: vpor {{.*}}(%rip), %xmm0, %xmm0
-+; CHECK-NEXT: vpsllw $15, %xmm0, %xmm0
-+; CHECK-NEXT: vpsraw $15, %xmm0, %xmm0
-+; CHECK-NEXT: vzeroupper
-+; CHECK-NEXT: retq
-+entry:
-+ %0 = trunc <8 x i32> %a to <8 x i23>
-+ %1 = icmp eq <8 x i23> %0, zeroinitializer
-+ %2 = or <8 x i1> %1, <i1 true, i1 true, i1 true, i1 true, i1 false, i1 false, i1 false, i1 false>
-+ %3 = sext <8 x i1> %2 to <8 x i16>
-+ ret <8 x i16> %3
-+}
diff --git a/contrib/llvm/patches/patch-09-clang-r250657-openmp.diff b/contrib/llvm/patches/patch-09-clang-r250657-openmp.diff
deleted file mode 100644
index e784673..0000000
--- a/contrib/llvm/patches/patch-09-clang-r250657-openmp.diff
+++ /dev/null
@@ -1,182 +0,0 @@
-Pull in r248379 from upstream clang trunk (by Jörg Sonnenberger):
-
- Refactor library decision for -fopenmp support from Darwin into a
- function for sharing with other platforms.
-
-Pull in r248424 from upstream clang trunk (by Jörg Sonnenberger):
-
- Push OpenMP linker flags after linker input on Darwin. Don't add any
- libraries if -nostdlib is specified. Test.
-
-Pull in r248426 from upstream clang trunk (by Jörg Sonnenberger):
-
- Support linking against OpenMP runtime on NetBSD.
-
-Pull in r250657 from upstream clang trunk (by Dimitry Andric):
-
- Support linking against OpenMP runtime on FreeBSD.
-
-Introduced here: http://svnweb.freebsd.org/changeset/base/289523
-
-Index: tools/clang/lib/Driver/Tools.cpp
-===================================================================
---- tools/clang/lib/Driver/Tools.cpp
-+++ tools/clang/lib/Driver/Tools.cpp
-@@ -2460,6 +2460,28 @@ static OpenMPRuntimeKind getOpenMPRuntime(const To
- return RT;
- }
-
-+static void addOpenMPRuntime(ArgStringList &CmdArgs, const ToolChain &TC,
-+ const ArgList &Args) {
-+ if (!Args.hasFlag(options::OPT_fopenmp, options::OPT_fopenmp_EQ,
-+ options::OPT_fno_openmp, false))
-+ return;
-+
-+ switch (getOpenMPRuntime(TC, Args)) {
-+ case OMPRT_OMP:
-+ CmdArgs.push_back("-lomp");
-+ break;
-+ case OMPRT_GOMP:
-+ CmdArgs.push_back("-lgomp");
-+ break;
-+ case OMPRT_IOMP5:
-+ CmdArgs.push_back("-liomp5");
-+ break;
-+ case OMPRT_Unknown:
-+ // Already diagnosed.
-+ break;
-+ }
-+}
-+
- static void addSanitizerRuntime(const ToolChain &TC, const ArgList &Args,
- ArgStringList &CmdArgs, StringRef Sanitizer,
- bool IsShared) {
-@@ -6527,24 +6549,6 @@ void darwin::Linker::ConstructJob(Compilation &C,
-
- Args.AddAllArgs(CmdArgs, options::OPT_L);
-
-- if (Args.hasFlag(options::OPT_fopenmp, options::OPT_fopenmp_EQ,
-- options::OPT_fno_openmp, false)) {
-- switch (getOpenMPRuntime(getToolChain(), Args)) {
-- case OMPRT_OMP:
-- CmdArgs.push_back("-lomp");
-- break;
-- case OMPRT_GOMP:
-- CmdArgs.push_back("-lgomp");
-- break;
-- case OMPRT_IOMP5:
-- CmdArgs.push_back("-liomp5");
-- break;
-- case OMPRT_Unknown:
-- // Already diagnosed.
-- break;
-- }
-- }
--
- AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs);
- // Build the input file for -filelist (list of linker input files) in case we
- // need it later
-@@ -6563,6 +6567,10 @@ void darwin::Linker::ConstructJob(Compilation &C,
- InputFileList.push_back(II.getFilename());
- }
-
-+ if (!Args.hasArg(options::OPT_nostdlib) &&
-+ !Args.hasArg(options::OPT_nodefaultlibs))
-+ addOpenMPRuntime(CmdArgs, getToolChain(), Args);
-+
- if (isObjCRuntimeLinked(Args) && !Args.hasArg(options::OPT_nostdlib) &&
- !Args.hasArg(options::OPT_nodefaultlibs)) {
- // We use arclite library for both ARC and subscripting support.
-@@ -7358,6 +7366,7 @@ void freebsd::Linker::ConstructJob(Compilation &C,
-
- if (!Args.hasArg(options::OPT_nostdlib) &&
- !Args.hasArg(options::OPT_nodefaultlibs)) {
-+ addOpenMPRuntime(CmdArgs, ToolChain, Args);
- if (D.CCCIsCXX()) {
- ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
- if (Args.hasArg(options::OPT_pg))
-@@ -7673,6 +7682,7 @@ void netbsd::Linker::ConstructJob(Compilation &C,
-
- if (!Args.hasArg(options::OPT_nostdlib) &&
- !Args.hasArg(options::OPT_nodefaultlibs)) {
-+ addOpenMPRuntime(CmdArgs, getToolChain(), Args);
- if (D.CCCIsCXX()) {
- getToolChain().AddCXXStdlibLibArgs(Args, CmdArgs);
- CmdArgs.push_back("-lm");
-Index: tools/clang/test/Driver/fopenmp.c
-===================================================================
---- tools/clang/test/Driver/fopenmp.c
-+++ tools/clang/test/Driver/fopenmp.c
-@@ -1,6 +1,15 @@
- // RUN: %clang -target x86_64-linux-gnu -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP
- // RUN: %clang -target x86_64-linux-gnu -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP
- // RUN: %clang -target x86_64-linux-gnu -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP
-+// RUN: %clang -target x86_64-apple-darwin -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP
-+// RUN: %clang -target x86_64-apple-darwin -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP
-+// RUN: %clang -target x86_64-apple-darwin -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP
-+// RUN: %clang -target x86_64-freebsd -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP
-+// RUN: %clang -target x86_64-freebsd -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP
-+// RUN: %clang -target x86_64-freebsd -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP
-+// RUN: %clang -target x86_64-netbsd -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP
-+// RUN: %clang -target x86_64-netbsd -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP
-+// RUN: %clang -target x86_64-netbsd -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP
- //
- // CHECK-CC1-OPENMP: "-cc1"
- // CHECK-CC1-OPENMP: "-fopenmp"
-@@ -12,6 +21,30 @@
- // RUN: %clang -target x86_64-linux-gnu -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP
- // RUN: %clang -target x86_64-linux-gnu -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5
- //
-+// RUN: %clang -nostdlib -target x86_64-linux-gnu -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP
-+// RUN: %clang -nostdlib -target x86_64-linux-gnu -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP
-+// RUN: %clang -nostdlib -target x86_64-linux-gnu -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5
-+//
-+// RUN: %clang -target x86_64-darwin -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP
-+// RUN: %clang -target x86_64-darwin -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP
-+// RUN: %clang -target x86_64-darwin -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5
-+//
-+// RUN: %clang -nostdlib -target x86_64-darwin -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP
-+// RUN: %clang -nostdlib -target x86_64-darwin -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP
-+// RUN: %clang -nostdlib -target x86_64-darwin -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5
-+//
-+// RUN: %clang -target x86_64-netbsd -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP
-+// RUN: %clang -target x86_64-netbsd -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP
-+// RUN: %clang -target x86_64-netbsd -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5
-+//
-+// RUN: %clang -nostdlib -target x86_64-freebsd -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP
-+// RUN: %clang -nostdlib -target x86_64-freebsd -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP
-+// RUN: %clang -nostdlib -target x86_64-freebsd -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5
-+//
-+// RUN: %clang -nostdlib -target x86_64-netbsd -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP
-+// RUN: %clang -nostdlib -target x86_64-netbsd -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP
-+// RUN: %clang -nostdlib -target x86_64-netbsd -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5
-+//
- // CHECK-LD-OMP: "{{.*}}ld{{(.exe)?}}"
- // CHECK-LD-OMP: "-lomp"
- //
-@@ -21,6 +54,15 @@
- // CHECK-LD-IOMP5: "{{.*}}ld{{(.exe)?}}"
- // CHECK-LD-IOMP5: "-liomp5"
- //
-+// CHECK-NO-OMP: "{{.*}}ld{{(.exe)?}}"
-+// CHECK-NO-OMP-NOT: "-lomp"
-+//
-+// CHECK-NO-GOMP: "{{.*}}ld{{(.exe)?}}"
-+// CHECK-NO-GOMP-NOT: "-lgomp"
-+//
-+// CHECK-NO-IOMP5: "{{.*}}ld{{(.exe)?}}"
-+// CHECK-NO-IOMP5-NOT: "-liomp5"
-+//
- // We'd like to check that the default is sane, but until we have the ability
- // to *always* semantically analyze OpenMP without always generating runtime
- // calls (in the event of an unsupported runtime), we don't have a good way to
-@@ -28,6 +70,9 @@
- // OpenMP runtime.
- //
- // RUN: %clang -target x86_64-linux-gnu -fopenmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANY
-+// RUN: %clang -target x86_64-darwin -fopenmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANY
-+// RUN: %clang -target x86_64-freebsd -fopenmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANY
-+// RUN: %clang -target x86_64-netbsd -fopenmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANY
- //
- // CHECK-LD-ANY: "{{.*}}ld{{(.exe)?}}"
- // CHECK-LD-ANY: "-l{{(omp|gomp|iomp5)}}"
OpenPOWER on IntegriCloud