[llvm] Update R600 patches

Adam Jackson ajax at fedoraproject.org
Fri Mar 8 17:46:01 UTC 2013


commit 97e156aa421670bd286ac2eb006f0cb70fa1bc57
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Mar 8 05:41:56 2013 -0500

    Update R600 patches
    
    - Move static libs to -static subpackage
    - Prep for F18 backport

 .gitignore                                         |    1 +
 ...AG-Allow-type-promotion-for-scalar-stores.patch |   30 ++++++++++
 ...galizeDAG-Allow-promotion-of-scalar-loads.patch |   29 ++++++++++
 ...-Avoid-generating-illegal-vector-INT_TO_F.patch |   53 +++++++++++++++++
 llvm.spec                                          |   60 +++++++++++++++-----
 sources                                            |    2 +-
 6 files changed, 160 insertions(+), 15 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 2c6da01..f398901 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@
 /llvm-3.2-R600-tstellar-git-b53ed46.patch.gz
 /llvm-3.2.src.tar.gz
 /clang-3.2.src.tar.gz
+/R600-Mesa-9.1.patch.gz
diff --git a/0001-LegalizeDAG-Allow-type-promotion-for-scalar-stores.patch b/0001-LegalizeDAG-Allow-type-promotion-for-scalar-stores.patch
new file mode 100644
index 0000000..72c81cf
--- /dev/null
+++ b/0001-LegalizeDAG-Allow-type-promotion-for-scalar-stores.patch
@@ -0,0 +1,30 @@
+From af4d115e2c9c4cfd8b099aaef9a13c2972c36272 Mon Sep 17 00:00:00 2001
+From: Tom Stellard <thomas.stellard at amd.com>
+Date: Thu, 6 Dec 2012 18:05:30 +0000
+Subject: [PATCH] LegalizeDAG: Allow type promotion for scalar stores
+
+---
+ lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+index abf40b7..9946694 100644
+--- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
++++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+@@ -731,9 +731,10 @@ void SelectionDAGLegalize::LegalizeStoreOps(SDNode *Node) {
+           return;
+         }
+         case TargetLowering::Promote: {
+-          assert(VT.isVector() && "Unknown legal promote case!");
+-          Value = DAG.getNode(ISD::BITCAST, dl,
+-                             TLI.getTypeToPromoteTo(ISD::STORE, VT), Value);
++          EVT NVT = TLI.getTypeToPromoteTo(ISD::STORE, VT);
++          assert(NVT.getSizeInBits() == VT.getSizeInBits() &&
++                 "Can only promote stores to same size type");
++          Value = DAG.getNode(ISD::BITCAST, dl, NVT, Value);
+           SDValue Result =
+             DAG.getStore(Chain, dl, Value, Ptr,
+                          ST->getPointerInfo(), isVolatile,
+-- 
+1.7.11.4
+
diff --git a/0002-LegalizeDAG-Allow-promotion-of-scalar-loads.patch b/0002-LegalizeDAG-Allow-promotion-of-scalar-loads.patch
new file mode 100644
index 0000000..f136bda
--- /dev/null
+++ b/0002-LegalizeDAG-Allow-promotion-of-scalar-loads.patch
@@ -0,0 +1,29 @@
+From 831cdb83e03319eeb36b6249e20e2908672397c2 Mon Sep 17 00:00:00 2001
+From: Tom Stellard <thomas.stellard at amd.com>
+Date: Thu, 6 Dec 2012 22:43:13 +0000
+Subject: [PATCH] LegalizeDAG: Allow promotion of scalar loads
+
+---
+ lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+index 9946694..2596f00 100644
+--- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
++++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+@@ -890,10 +890,9 @@ void SelectionDAGLegalize::LegalizeLoadOps(SDNode *Node) {
+       break;
+     }
+     case TargetLowering::Promote: {
+-      // Only promote a load of vector type to another.
+-      assert(VT.isVector() && "Cannot promote this load!");
+-      // Change base type to a different vector type.
+       EVT NVT = TLI.getTypeToPromoteTo(Node->getOpcode(), VT);
++      assert(NVT.getSizeInBits() == VT.getSizeInBits() &&
++             "Can only promote loads to same size type");
+ 
+       SDValue Res = DAG.getLoad(NVT, dl, Chain, Ptr, LD->getPointerInfo(),
+                          LD->isVolatile(), LD->isNonTemporal(),
+-- 
+1.7.11.4
+
diff --git a/0003-DAGCombiner-Avoid-generating-illegal-vector-INT_TO_F.patch b/0003-DAGCombiner-Avoid-generating-illegal-vector-INT_TO_F.patch
new file mode 100644
index 0000000..f4c4e1e
--- /dev/null
+++ b/0003-DAGCombiner-Avoid-generating-illegal-vector-INT_TO_F.patch
@@ -0,0 +1,53 @@
+From 85259e7305201764ae9d85a7cbf2809da779bf5c Mon Sep 17 00:00:00 2001
+From: tstellar <tstellar at 91177308-0d34-0410-b5e6-96231b3b80d8>
+Date: Wed, 2 Jan 2013 22:13:01 +0000
+Subject: [PATCH] DAGCombiner: Avoid generating illegal vector INT_TO_FP nodes
+
+DAGCombiner::reduceBuildVecConvertToConvertBuildVec() was making two
+mistakes:
+
+1. It was checking the legality of scalar INT_TO_FP nodes and then generating
+vector nodes.
+
+2. It was passing the result value type to
+TargetLoweringInfo::getOperationAction() when it should have been
+passing the value type of the first operand.
+
+git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171420 91177308-0d34-0410-b5e6-96231b3b80d8
+---
+ lib/CodeGen/SelectionDAG/DAGCombiner.cpp           |  9 +++---
+ .../R600/dagcombiner-bug-illegal-vec4-int-to-fp.ll | 33 ++++++++++++++++++++++
+ test/CodeGen/R600/vec4-expand.ll                   |  3 --
+ test/CodeGen/X86/cvtv2f32.ll                       |  4 +++
+ 4 files changed, 42 insertions(+), 7 deletions(-)
+ create mode 100644 test/CodeGen/R600/dagcombiner-bug-illegal-vec4-int-to-fp.ll
+
+diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+index 37d7731..d0ca5c0 100644
+--- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
++++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+@@ -8514,11 +8514,8 @@ SDValue DAGCombiner::reduceBuildVecConvertToConvertBuildVec(SDNode *N) {
+     if (Opcode == ISD::DELETED_NODE &&
+         (Opc == ISD::UINT_TO_FP || Opc == ISD::SINT_TO_FP)) {
+       Opcode = Opc;
+-      // If not supported by target, bail out.
+-      if (TLI.getOperationAction(Opcode, VT) != TargetLowering::Legal &&
+-          TLI.getOperationAction(Opcode, VT) != TargetLowering::Custom)
+-        return SDValue();
+     }
++
+     if (Opc != Opcode)
+       return SDValue();
+ 
+@@ -8543,6 +8540,10 @@ SDValue DAGCombiner::reduceBuildVecConvertToConvertBuildVec(SDNode *N) {
+   assert(SrcVT != MVT::Other && "Cannot determine source type!");
+ 
+   EVT NVT = EVT::getVectorVT(*DAG.getContext(), SrcVT, NumInScalars);
++
++  if (!TLI.isOperationLegalOrCustom(Opcode, NVT))
++    return SDValue();
++
+   SmallVector<SDValue, 8> Opnds;
+   for (unsigned i = 0; i != NumInScalars; ++i) {
+     SDValue In = N->getOperand(i);
+
diff --git a/llvm.spec b/llvm.spec
index 75f1606..4aa3802 100644
--- a/llvm.spec
+++ b/llvm.spec
@@ -6,7 +6,11 @@
 
 # clang header paths are hard-coded at compile time
 # and need adjustment whenever there's a new GCC version
+%if 0%{?fedora} == 18
+%global gcc_version 4.7.2
+%else
 %global gcc_version 4.8.0
+%endif
 
 %ifarch s390 s390x sparc64
   # No ocaml on these arches
@@ -15,12 +19,7 @@
   %bcond_without ocaml
 %endif
 
-%if 0%{?rhel} >= 7
-%bcond_with clang
-ExcludeArch: s390 s390x ppc ppc64
-%else
 %bcond_without clang
-%endif
 
 #global prerel rcX
 %global downloadurl http://llvm.org/%{?prerel:pre-}releases/%{version}%{?prerel:/%{prerel}}
@@ -36,7 +35,7 @@ ExcludeArch: s390 s390x ppc ppc64
 
 Name:           llvm
 Version:        3.2
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        The Low Level Virtual Machine
 
 Group:          Development/Languages
@@ -53,9 +52,22 @@ Patch0:         llvm-2.6-timestamp.patch
 
 Patch10:        llvm-3.2-clang-driver-secondary-arch-triplets.patch
 
-# diff generated against http://cgit.freedesktop.org/~tstellar/llvm/
-# (includes committed http://people.freedesktop.org/~tstellar/llvm/3.2/bug-fixes/)
-Patch600:        llvm-3.2-R600-tstellar-git-b53ed46.patch.gz
+# hack llvm-config to print -lLLVM-3.2svn instead of ALL THE THINGS
+#
+# you really, really, really want not to use the static libs, otherwise
+# if you ever end up with two (static) copies of llvm in the same process
+# things will go boom quite nicely
+# 
+# this isn't enabled yet because it makes the ocaml bindings fail the
+# test suite.  i don't even.
+Patch20:	llvm-3.2-llvm-config-dso-hack.patch
+
+# from http://people.freedesktop.org/~tstellar/llvm/3.2/ as of 7 March 2013
+# ref: http://lists.freedesktop.org/archives/mesa-dev/2013-March/035561.html
+Patch600:	R600-Mesa-9.1.patch.gz
+Patch601:	0001-LegalizeDAG-Allow-type-promotion-for-scalar-stores.patch
+Patch602:	0002-LegalizeDAG-Allow-promotion-of-scalar-loads.patch
+Patch603:	0003-DAGCombiner-Avoid-generating-illegal-vector-INT_TO_F.patch
 
 BuildRequires:  bison
 BuildRequires:  chrpath
@@ -96,7 +108,6 @@ Group:          Development/Languages
 Requires:       %{name}%{?_isa} = %{version}-%{release}
 Requires:       libffi-devel
 Requires:       libstdc++-devel >= 3.4
-Provides:       llvm-static = %{version}-%{release}
 
 Requires(posttrans): /usr/sbin/alternatives
 Requires(postun):    /usr/sbin/alternatives
@@ -127,6 +138,16 @@ Group:          System Environment/Libraries
 Shared libraries for the LLVM compiler infrastructure.
 
 
+%package static
+Summary:	LLVM static libraries
+Group:		Development/Languages
+Requires:	%{name}-devel%{?_isa} = %{version}-%{release}
+
+%description static
+Static libraries for the LLVM compiler infrastructure.  Not recommended
+for general consumption.
+
+
 %if %{with clang}
 %package -n clang
 Summary:        A C language family front-end for LLVM
@@ -257,7 +278,13 @@ mv clang-%{version}%{?prerel}.src tools/clang
 # clang triplets
 %patch10 -p1 -b .orig
 
+# fix llvm-config --libs
+#patch20 -p1 -b .orig
+
 %patch600 -p1 -b .orig
+%patch601 -p1 -b .orig
+%patch602 -p1 -b .orig
+%patch603 -p1 -b .orig
 
 # fix ld search path
 sed -i 's|/lib /usr/lib $lt_ld_extra|%{_libdir} $lt_ld_extra|' \
@@ -282,9 +309,6 @@ export CXX=c++
 %if %{with gold}
   --with-binutils-include=%{_includedir} \
 %endif
-%if 0%{?rhel} >= 7
-  --enable-targets=host \
-%endif
 %ifarch armv7hl armv7l
   --with-cpu=cortex-a8 \
   --with-tune=cortex-a8 \
@@ -475,7 +499,6 @@ exit 0
 %{_bindir}/llvm-config-%{__isa_bits}
 %{_includedir}/%{name}
 %{_includedir}/%{name}-c
-%{_libdir}/%{name}/*.a
 
 %files libs
 %defattr(-,root,root,-)
@@ -486,6 +509,10 @@ exit 0
 %endif
 %{_libdir}/%{name}/*.so
 
+%files static
+%defattr(-,root,root,-)
+%{_libdir}/%{name}/*.a
+
 %if %{with clang}
 %files -n clang
 %defattr(-,root,root,-)
@@ -547,6 +574,11 @@ exit 0
 %endif
 
 %changelog
+* Fri Mar 08 2013 Adam Jackson <ajax at redhat.com> 3.2-2
+- Update R600 patches
+- Move static libs to -static subpackage
+- Prep for F18 backport
+
 * Wed Feb 13 2013 Jens Petersen <petersen at redhat.com> - 3.2-1
 - update to 3.2
 - update R600 patches to Tom Stellard's git tree
diff --git a/sources b/sources
index 15c790f..ee6fb33 100644
--- a/sources
+++ b/sources
@@ -1,3 +1,3 @@
 3896ef4334df08563b05d0848ba80582  clang-3.2.src.tar.gz
 71610289bbc819e3e15fdd562809a2d7  llvm-3.2.src.tar.gz
-0c32fc1b5ccabe5470c0d1083f6d800c  llvm-3.2-R600-tstellar-git-b53ed46.patch.gz
+610deacbd5928bbc62f630512f7d0292  R600-Mesa-9.1.patch.gz


More information about the scm-commits mailing list