@@ -2836,9 +2836,8 @@ SDValue SystemZTargetLowering::lowerVACOPY(SDValue Op,
28362836SDValue SystemZTargetLowering::
28372837lowerDYNAMIC_STACKALLOC (SDValue Op, SelectionDAG &DAG) const {
28382838 const TargetFrameLowering *TFI = Subtarget.getFrameLowering ();
2839- MachineFunction &MF = DAG.getMachineFunction ();
2840- bool RealignOpt = !MF.getFunction ()-> hasFnAttribute (" no-realign-stack" );
2841- bool StoreBackchain = MF.getFunction ()->hasFnAttribute (" backchain" );
2839+ bool RealignOpt = !DAG.getMachineFunction ().getFunction ()->
2840+ hasFnAttribute (" no-realign-stack" );
28422841
28432842 SDValue Chain = Op.getOperand (0 );
28442843 SDValue Size = Op.getOperand (1 );
@@ -2860,12 +2859,6 @@ lowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG) const {
28602859 // Get a reference to the stack pointer.
28612860 SDValue OldSP = DAG.getCopyFromReg (Chain, DL, SPReg, MVT::i64 );
28622861
2863- // If we need a backchain, save it now.
2864- SDValue Backchain;
2865- if (StoreBackchain)
2866- Backchain = DAG.getLoad (MVT::i64 , DL, Chain, OldSP, MachinePointerInfo (),
2867- false , false , false , 0 );
2868-
28692862 // Add extra space for alignment if needed.
28702863 if (ExtraAlignSpace)
28712864 NeededSpace = DAG.getNode (ISD::ADD, DL, MVT::i64 , NeededSpace,
@@ -2893,10 +2886,6 @@ lowerDYNAMIC_STACKALLOC(SDValue Op, SelectionDAG &DAG) const {
28932886 DAG.getConstant (~(RequiredAlign - 1 ), DL, MVT::i64 ));
28942887 }
28952888
2896- if (StoreBackchain)
2897- Chain = DAG.getStore (Chain, DL, Backchain, NewSP, MachinePointerInfo (),
2898- false , false , 0 );
2899-
29002889 SDValue Ops[2 ] = { Result, Chain };
29012890 return DAG.getMergeValues (Ops, DL);
29022891}
@@ -3355,26 +3344,8 @@ SDValue SystemZTargetLowering::lowerSTACKRESTORE(SDValue Op,
33553344 SelectionDAG &DAG) const {
33563345 MachineFunction &MF = DAG.getMachineFunction ();
33573346 MF.getInfo <SystemZMachineFunctionInfo>()->setManipulatesSP (true );
3358- bool StoreBackchain = MF.getFunction ()->hasFnAttribute (" backchain" );
3359-
3360- SDValue Chain = Op.getOperand (0 );
3361- SDValue NewSP = Op.getOperand (1 );
3362- SDValue Backchain;
3363- SDLoc DL (Op);
3364-
3365- if (StoreBackchain) {
3366- SDValue OldSP = DAG.getCopyFromReg (Chain, DL, SystemZ::R15D, MVT::i64 );
3367- Backchain = DAG.getLoad (MVT::i64 , DL, Chain, OldSP, MachinePointerInfo (),
3368- false , false , false , 0 );
3369- }
3370-
3371- Chain = DAG.getCopyToReg (Chain, DL, SystemZ::R15D, NewSP);
3372-
3373- if (StoreBackchain)
3374- Chain = DAG.getStore (Chain, DL, Backchain, NewSP, MachinePointerInfo (),
3375- false , false , 0 );
3376-
3377- return Chain;
3347+ return DAG.getCopyToReg (Op.getOperand (0 ), SDLoc (Op),
3348+ SystemZ::R15D, Op.getOperand (1 ));
33783349}
33793350
33803351SDValue SystemZTargetLowering::lowerPREFETCH (SDValue Op,
0 commit comments