Skip to content

Commit 898616a

Browse files
author
git apple-llvm automerger
committed
Merge commit 'b5234b64af83' from llvm.org/master into apple/master
2 parents 9e33227 + b5234b6 commit 898616a

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,9 @@ class AMDGPUDAGToDAGISel : public SelectionDAGISel {
172172

173173
MachineSDNode *buildSMovImm64(SDLoc &DL, uint64_t Val, EVT VT) const;
174174

175-
SDNode *glueCopyToM0LDSInit(SDNode *N) const;
175+
SDNode *glueCopyToOp(SDNode *N, SDValue NewChain, SDValue Glue) const;
176176
SDNode *glueCopyToM0(SDNode *N, SDValue Val) const;
177+
SDNode *glueCopyToM0LDSInit(SDNode *N) const;
177178

178179
const TargetRegisterClass *getOperandRegClass(SDNode *N, unsigned OpNo) const;
179180
virtual bool SelectADDRVTX_READ(SDValue Addr, SDValue &Base, SDValue &Offset);
@@ -585,26 +586,27 @@ const TargetRegisterClass *AMDGPUDAGToDAGISel::getOperandRegClass(SDNode *N,
585586
}
586587
}
587588

588-
SDNode *AMDGPUDAGToDAGISel::glueCopyToM0(SDNode *N, SDValue Val) const {
589-
const SITargetLowering& Lowering =
590-
*static_cast<const SITargetLowering*>(getTargetLowering());
591-
592-
assert(N->getOperand(0).getValueType() == MVT::Other && "Expected chain");
593-
594-
SDValue M0 = Lowering.copyToM0(*CurDAG, N->getOperand(0), SDLoc(N),
595-
Val);
596-
597-
SDValue Glue = M0.getValue(1);
598-
589+
SDNode *AMDGPUDAGToDAGISel::glueCopyToOp(SDNode *N, SDValue NewChain,
590+
SDValue Glue) const {
599591
SmallVector <SDValue, 8> Ops;
600-
Ops.push_back(M0); // Replace the chain.
592+
Ops.push_back(NewChain); // Replace the chain.
601593
for (unsigned i = 1, e = N->getNumOperands(); i != e; ++i)
602594
Ops.push_back(N->getOperand(i));
603595

604596
Ops.push_back(Glue);
605597
return CurDAG->MorphNodeTo(N, N->getOpcode(), N->getVTList(), Ops);
606598
}
607599

600+
SDNode *AMDGPUDAGToDAGISel::glueCopyToM0(SDNode *N, SDValue Val) const {
601+
const SITargetLowering& Lowering =
602+
*static_cast<const SITargetLowering*>(getTargetLowering());
603+
604+
assert(N->getOperand(0).getValueType() == MVT::Other && "Expected chain");
605+
606+
SDValue M0 = Lowering.copyToM0(*CurDAG, N->getOperand(0), SDLoc(N), Val);
607+
return glueCopyToOp(N, M0, M0.getValue(1));
608+
}
609+
608610
SDNode *AMDGPUDAGToDAGISel::glueCopyToM0LDSInit(SDNode *N) const {
609611
unsigned AS = cast<MemSDNode>(N)->getAddressSpace();
610612
if (AS == AMDGPUAS::LOCAL_ADDRESS) {

0 commit comments

Comments
 (0)