From 1f2dd632ff93a2eb087001aec3e7f9321777bf05 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 17 Aug 2018 08:49:56 +0200 Subject: [PATCH] Cherry-pick a patch from 7 to fix an issue with Julia on powerpc - PowerPC-Make-AddrSpaceCast-noop.diff (Closes: #906314) --- debian/changelog | 8 ++++ .../PowerPC-Make-AddrSpaceCast-noop.diff | 43 +++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 52 insertions(+) create mode 100644 debian/patches/PowerPC-Make-AddrSpaceCast-noop.diff diff --git a/debian/changelog b/debian/changelog index 236c4ac6..0c329353 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +llvm-toolchain-6.0 (1:6.0.1-5) unstable; urgency=medium + + * Cherry-pick a patch from 7 to fix an issue with Julia + on powerpc - PowerPC-Make-AddrSpaceCast-noop.diff + (Closes: #906314) + + -- Sylvestre Ledru Fri, 17 Aug 2018 08:49:22 +0200 + llvm-toolchain-6.0 (1:6.0.1-4) unstable; urgency=medium * Disable force-gcc-header-obj.diff as it is introducing diff --git a/debian/patches/PowerPC-Make-AddrSpaceCast-noop.diff b/debian/patches/PowerPC-Make-AddrSpaceCast-noop.diff new file mode 100644 index 00000000..bca07b55 --- /dev/null +++ b/debian/patches/PowerPC-Make-AddrSpaceCast-noop.diff @@ -0,0 +1,43 @@ +Index: llvm-toolchain-6.0-6.0.1/CodeGen/PowerPC/addrspacecast.ll +=================================================================== +--- /dev/null ++++ llvm-toolchain-6.0-6.0.1/CodeGen/PowerPC/addrspacecast.ll +@@ -0,0 +1,22 @@ ++; RUN: llc -mtriple=powerpc64le-unknown-linux-gnu %s -o - | FileCheck %s ++ ++; Check that codegen for an addrspace cast succeeds without error. ++define <4 x i32 addrspace(1)*> @f (<4 x i32*> %x) { ++ %1 = addrspacecast <4 x i32*> %x to <4 x i32 addrspace(1)*> ++ ret <4 x i32 addrspace(1)*> %1 ++ ; CHECK-LABEL: @f ++} ++ ++; Check that fairly complicated addrspace cast and operations succeed without error. ++%struct = type opaque ++define void @g (%struct addrspace(10)** %x) { ++ %1 = load %struct addrspace(10)*, %struct addrspace(10)** %x ++ %2 = addrspacecast %struct addrspace(10)* %1 to %struct addrspace(11)* ++ %3 = bitcast %struct addrspace(11)* %2 to i8 addrspace(11)* ++ %4 = getelementptr i8, i8 addrspace(11)* %3, i64 16 ++ %5 = bitcast i8 addrspace(11)* %4 to %struct addrspace(10)* addrspace(11)* ++ %6 = load %struct addrspace(10)*, %struct addrspace(10)* addrspace(11)* %5 ++ store %struct addrspace(10)* %6, %struct addrspace(10)** undef ++ ret void ++ ; CHECK-LABEL: @g ++} +Index: llvm-toolchain-6.0-6.0.1/lib/Target/PowerPC/PPCISelLowering.h +=================================================================== +--- llvm-toolchain-6.0-6.0.1.orig/lib/Target/PowerPC/PPCISelLowering.h ++++ llvm-toolchain-6.0-6.0.1/lib/Target/PowerPC/PPCISelLowering.h +@@ -884,6 +884,11 @@ namespace llvm { + } + }; + ++ bool isNoopAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const override { ++ // Addrspacecasts are always noops. ++ return true; ++ } ++ + bool canReuseLoadAddress(SDValue Op, EVT MemVT, ReuseLoadInfo &RLI, + SelectionDAG &DAG, + ISD::LoadExtType ET = ISD::NON_EXTLOAD) const; diff --git a/debian/patches/series b/debian/patches/series index 59eaa264..66b6cc3b 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -59,3 +59,4 @@ D40146-JumpThreading-backport-1.diff D42717-JumpThreading-backport-2.diff llvm-D49832-SCEVPred.patch llvm-rL323946-LSRTy.patch +PowerPC-Make-AddrSpaceCast-noop.diff