[llvm] r268576 - Revert "[SystemZ] Implement backchain attribute."
Marcin Koscielnicki via llvm-commits
llvm-commits at lists.llvm.org
Wed May 4 16:54:54 PDT 2016
Author: koriakin
Date: Wed May 4 18:54:53 2016
New Revision: 268576
URL: http://llvm.org/viewvc/llvm-project?rev=268576&view=rev
Log:
Revert "[SystemZ] Implement backchain attribute."
This reverts commit rL268571.
It caused failures in register scavenger.
Removed:
llvm/trunk/test/CodeGen/SystemZ/backchain.ll
Modified:
llvm/trunk/lib/Target/SystemZ/SystemZFrameLowering.cpp
llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp
Modified: llvm/trunk/lib/Target/SystemZ/SystemZFrameLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZFrameLowering.cpp?rev=268576&r1=268575&r2=268576&view=diff
==============================================================================
--- llvm/trunk/lib/Target/SystemZ/SystemZFrameLowering.cpp (original)
+++ llvm/trunk/lib/Target/SystemZ/SystemZFrameLowering.cpp Wed May 4 18:54:53 2016
@@ -354,15 +354,6 @@ void SystemZFrameLowering::emitPrologue(
uint64_t StackSize = getAllocatedStackSize(MF);
if (StackSize) {
- // Determine if we want to store a backchain.
- bool StoreBackchain = MF.getFunction()->hasFnAttribute("backchain");
-
- // If we need backchain, save current stack pointer. R1 is free at this
- // point.
- if (StoreBackchain)
- BuildMI(MBB, MBBI, DL, ZII->get(SystemZ::LGR))
- .addReg(SystemZ::R1D).addReg(SystemZ::R15D);
-
// Allocate StackSize bytes.
int64_t Delta = -int64_t(StackSize);
emitIncrement(MBB, MBBI, DL, SystemZ::R15D, Delta, ZII);
@@ -373,10 +364,6 @@ void SystemZFrameLowering::emitPrologue(
BuildMI(MBB, MBBI, DL, ZII->get(TargetOpcode::CFI_INSTRUCTION))
.addCFIIndex(CFIIndex);
SPOffsetFromCFA += Delta;
-
- if (StoreBackchain)
- BuildMI(MBB, MBBI, DL, ZII->get(SystemZ::STG))
- .addReg(SystemZ::R1D).addReg(SystemZ::R15D).addImm(0).addReg(0);
}
if (HasFP) {
Modified: llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp?rev=268576&r1=268575&r2=268576&view=diff
==============================================================================
--- llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp Wed May 4 18:54:53 2016
@@ -2836,9 +2836,8 @@ SDValue SystemZTargetLowering::lowerVACO
SDValue SystemZTargetLowering::
lowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG) const {
const TargetFrameLowering *TFI = Subtarget.getFrameLowering();
- MachineFunction &MF = DAG.getMachineFunction();
- bool RealignOpt = !MF.getFunction()-> hasFnAttribute("no-realign-stack");
- bool StoreBackchain = MF.getFunction()->hasFnAttribute("backchain");
+ bool RealignOpt = !DAG.getMachineFunction().getFunction()->
+ hasFnAttribute("no-realign-stack");
SDValue Chain = Op.getOperand(0);
SDValue Size = Op.getOperand(1);
@@ -2860,12 +2859,6 @@ lowerDYNAMIC_STACKALLOC(SDValue Op, Sele
// Get a reference to the stack pointer.
SDValue OldSP = DAG.getCopyFromReg(Chain, DL, SPReg, MVT::i64);
- // If we need a backchain, save it now.
- SDValue Backchain;
- if (StoreBackchain)
- Backchain = DAG.getLoad(MVT::i64, DL, Chain, OldSP, MachinePointerInfo(),
- false, false, false, 0);
-
// Add extra space for alignment if needed.
if (ExtraAlignSpace)
NeededSpace = DAG.getNode(ISD::ADD, DL, MVT::i64, NeededSpace,
@@ -2893,10 +2886,6 @@ lowerDYNAMIC_STACKALLOC(SDValue Op, Sele
DAG.getConstant(~(RequiredAlign - 1), DL, MVT::i64));
}
- if (StoreBackchain)
- Chain = DAG.getStore(Chain, DL, Backchain, NewSP, MachinePointerInfo(),
- false, false, 0);
-
SDValue Ops[2] = { Result, Chain };
return DAG.getMergeValues(Ops, DL);
}
@@ -3355,26 +3344,8 @@ SDValue SystemZTargetLowering::lowerSTAC
SelectionDAG &DAG) const {
MachineFunction &MF = DAG.getMachineFunction();
MF.getInfo<SystemZMachineFunctionInfo>()->setManipulatesSP(true);
- bool StoreBackchain = MF.getFunction()->hasFnAttribute("backchain");
-
- SDValue Chain = Op.getOperand(0);
- SDValue NewSP = Op.getOperand(1);
- SDValue Backchain;
- SDLoc DL(Op);
-
- if (StoreBackchain) {
- SDValue OldSP = DAG.getCopyFromReg(Chain, DL, SystemZ::R15D, MVT::i64);
- Backchain = DAG.getLoad(MVT::i64, DL, Chain, OldSP, MachinePointerInfo(),
- false, false, false, 0);
- }
-
- Chain = DAG.getCopyToReg(Chain, DL, SystemZ::R15D, NewSP);
-
- if (StoreBackchain)
- Chain = DAG.getStore(Chain, DL, Backchain, NewSP, MachinePointerInfo(),
- false, false, 0);
-
- return Chain;
+ return DAG.getCopyToReg(Op.getOperand(0), SDLoc(Op),
+ SystemZ::R15D, Op.getOperand(1));
}
SDValue SystemZTargetLowering::lowerPREFETCH(SDValue Op,
Removed: llvm/trunk/test/CodeGen/SystemZ/backchain.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/SystemZ/backchain.ll?rev=268575&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/SystemZ/backchain.ll (original)
+++ llvm/trunk/test/CodeGen/SystemZ/backchain.ll (removed)
@@ -1,84 +0,0 @@
-; Test the backchain attribute.
-;
-; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
-
-declare i8 *@llvm.stacksave()
-declare void @llvm.stackrestore(i8 *)
-declare void @g()
-
-; nothing should happen if no stack frame is needed.
-define void @f1() "backchain" {
-; CHECK-LABEL: f1:
-; CHECK-NOT: stg
- ret void
-}
-
-; check that backchain is saved if we call someone
-define void @f2() "backchain" {
-; CHECK-LABEL: f2:
-; CHECK: stmg %r14, %r15, 112(%r15)
-; CHECK: lgr %r1, %r15
-; CHECK: aghi %r15, -160
-; CHECK: stg %r1, 0(%r15)
- call void @g()
- call void @g()
- ret void
-}
-
-; check that backchain is saved if we have an alloca
-define void @f3() "backchain" {
-; CHECK-LABEL: f3:
-; CHECK-NOT: stmg
-; CHECK: lgr %r1, %r15
-; CHECK: aghi %r15, -168
-; CHECK: stg %r1, 0(%r15)
- %ign = alloca i8, i32 4
- ret void
-}
-
-; check that alloca copies the backchain
-define void @f4(i32 %len) "backchain" {
-; CHECK-LABEL: f4:
-; CHECK: stmg %r11, %r15, 88(%r15)
-; CHECK: lgr %r1, %r15
-; CHECK: aghi %r15, -160
-; CHECK: stg %r1, 0(%r15)
-; CHECK: lgr %r11, %r15
-; CHECK: lg [[BC:%r[0-9]+]], 0(%r15)
-; CHECK: lgr [[NEWSP:%r[0-9]+]], %r15
-; CHECK: lgr %r15, [[NEWSP]]
-; CHECK: stg [[BC]], 0([[NEWSP]])
- %ign = alloca i8, i32 %len
- ret void
-}
-
-; check that llvm.stackrestore restores the backchain
-define void @f5(i32 %count1, i32 %count2) "backchain" {
-; CHECK-LABEL: f5:
-; CHECK: stmg %r11, %r15, 88(%r15)
-; CHECK: lgr %r1, %r15
-; CHECK: aghi %r15, -160
-; CHECK: stg %r1, 0(%r15)
-; CHECK: lgr %r11, %r15
-; CHECK: lgr [[SAVESP:%r[0-9]+]], %r15
-; CHECK: lg [[BC:%r[0-9]+]], 0(%r15)
-; CHECK: lgr [[NEWSP:%r[0-9]+]], %r15
-; CHECK: lgr %r15, [[NEWSP]]
-; CHECK: stg [[BC]], 0([[NEWSP]])
-; CHECK: lg [[BC2:%r[0-9]+]], 0(%r15)
-; CHECK: lgr %r15, [[SAVESP]]
-; CHECK: stg [[BC2]], 0([[SAVESP]])
-; CHECK: lg [[BC3:%r[0-9]+]], 0(%r15)
-; CHECK: lgr [[NEWSP2:%r[0-9]+]], %r15
-; CHECK: lgr %r15, [[NEWSP2]]
-; CHECK: stg [[BC3]], 0([[NEWSP2]])
-; CHECK: lmg %r11, %r15, 248(%r11)
-; CHECK: br %r14
- %src = call i8 *@llvm.stacksave()
- %array1 = alloca i8, i32 %count1
- store volatile i8 0, i8 *%array1
- call void @llvm.stackrestore(i8 *%src)
- %array2 = alloca i8, i32 %count2
- store volatile i8 0, i8 *%array2
- ret void
-}
More information about the llvm-commits
mailing list