From e9ead2b8b4fe11afff8708cb50374313502f9a8b Mon Sep 17 00:00:00 2001 From: Gianfranco Costamagna Date: Thu, 23 Aug 2018 10:26:28 +0200 Subject: [PATCH] Add rustc patch from --- debian/changelog | 1 + debian/patches/D51108.diff | 65 ++++++++++++++++++++++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 67 insertions(+) create mode 100644 debian/patches/D51108.diff diff --git a/debian/changelog b/debian/changelog index cb84e197..15def996 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,7 @@ llvm-toolchain-6.0 (1:6.0.1-6) unstable; urgency=medium [ John Paul Adrian Glaubitz ] * Don't build with ld.gold on powerpcspe * Disable polly on powerpcspe + * Cherry-pick upstream patch to make rustc build on ppc [ Gianfranco Costamagna ] * Team upload diff --git a/debian/patches/D51108.diff b/debian/patches/D51108.diff new file mode 100644 index 00000000..aa7f7196 --- /dev/null +++ b/debian/patches/D51108.diff @@ -0,0 +1,65 @@ +Index: llvm-toolchain-6.0-6.0.1/lib/Target/PowerPC/PPCISelLowering.cpp +=================================================================== +--- llvm-toolchain-6.0-6.0.1.orig/lib/Target/PowerPC/PPCISelLowering.cpp ++++ llvm-toolchain-6.0-6.0.1/lib/Target/PowerPC/PPCISelLowering.cpp +@@ -3351,9 +3351,14 @@ + // Argument stored in memory. + assert(VA.isMemLoc()); + ++ // Get the extended size of the argument type in stack + unsigned ArgSize = VA.getLocVT().getStoreSize(); +- int FI = MFI.CreateFixedObject(ArgSize, VA.getLocMemOffset(), +- isImmutable); ++ // Get the actual size of the argument type ++ unsigned ObjSize = VA.getValVT().getStoreSize(); ++ unsigned ArgOffset = VA.getLocMemOffset(); ++ // Stack objects in PPC32 are right justified. ++ ArgOffset += ArgSize - ObjSize; ++ int FI = MFI.CreateFixedObject(ArgSize, ArgOffset, isImmutable); + + // Create load nodes to retrieve arguments from the stack. + SDValue FIN = DAG.getFrameIndex(FI, PtrVT); +@@ -5303,10 +5308,11 @@ + Arg = PtrOff; + } + +- if (VA.isRegLoc()) { +- if (Arg.getValueType() == MVT::i1) +- Arg = DAG.getNode(ISD::ZERO_EXTEND, dl, MVT::i32, Arg); ++ // Ensure callee will get either 0x00000001 or 0x00000000. ++ if (Arg.getValueType() == MVT::i1) ++ Arg = DAG.getNode(ISD::ZERO_EXTEND, dl, MVT::i32, Arg); + ++ if (VA.isRegLoc()) { + seenFloatArg |= VA.getLocVT().isFloatingPoint(); + // Put argument in a physical register. + RegsToPass.push_back(std::make_pair(VA.getLocReg(), Arg)); +Index: llvm-toolchain-6.0-6.0.1/test/CodeGen/PowerPC/ppc32-i1-stack-arguments-abi-bug.ll +=================================================================== +--- /dev/null ++++ llvm-toolchain-6.0-6.0.1/test/CodeGen/PowerPC/ppc32-i1-stack-arguments-abi-bug.ll +@@ -0,0 +1,24 @@ ++; RUN: llc -verify-machineinstrs < %s -mcpu=ppc32 -mattr=+crbits | FileCheck %s ++target triple = "powerpc-unknown-linux-gnu" ++ ++define zeroext i1 @check_callee( ++ i1 zeroext, i1 zeroext, i1 zeroext, i1 zeroext, ++ i1 zeroext, i1 zeroext, i1 zeroext, i1 zeroext, ++ i1 zeroext %s1 ++) { ++ call void @check_caller( ++ i1 zeroext true, i1 zeroext true, i1 zeroext true, i1 zeroext true, ++ i1 zeroext true, i1 zeroext true, i1 zeroext true, i1 zeroext true, ++ i1 zeroext %s1) ++ ret i1 true ++} ++ ++; CHECK-LABEL: @check_callee ++; CHECK: lbz {{[0-9]+}}, 27(1) ++; CHECK: stw {{[0-9]+}}, 8(1) ++ ++declare void @check_caller( ++ i1 zeroext, i1 zeroext, i1 zeroext, i1 zeroext, ++ i1 zeroext, i1 zeroext, i1 zeroext, i1 zeroext, ++ i1 zeroext ++) diff --git a/debian/patches/series b/debian/patches/series index 66b6cc3b..c901e764 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -60,3 +60,4 @@ D42717-JumpThreading-backport-2.diff llvm-D49832-SCEVPred.patch llvm-rL323946-LSRTy.patch PowerPC-Make-AddrSpaceCast-noop.diff +D51108.diff