diff --git a/include/llvm/CodeGen/SelectionDAG.h b/include/llvm/CodeGen/SelectionDAG.h index 74aa8ff8203..35b5cd6b7dd 100644 --- a/include/llvm/CodeGen/SelectionDAG.h +++ b/include/llvm/CodeGen/SelectionDAG.h @@ -302,8 +302,8 @@ public: SDValue getArgFlags(ISD::ArgFlagsTy Flags); SDValue getValueType(MVT); SDValue getRegister(unsigned Reg, MVT VT); - SDValue getDbgStopPoint(SDValue Root, unsigned Line, unsigned Col, - Value *CU); + SDValue getDbgStopPoint(DebugLoc DL, SDValue Root, + unsigned Line, unsigned Col, Value *CU); SDValue getLabel(unsigned Opcode, DebugLoc dl, SDValue Root, unsigned LabelID); diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index b33b4691245..0b27ccf549a 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -1273,11 +1273,12 @@ SDValue SelectionDAG::getRegister(unsigned RegNo, MVT VT) { return SDValue(N, 0); } -SDValue SelectionDAG::getDbgStopPoint(SDValue Root, +SDValue SelectionDAG::getDbgStopPoint(DebugLoc DL, SDValue Root, unsigned Line, unsigned Col, Value *CU) { SDNode *N = NodeAllocator.Allocate(); new (N) DbgStopPointSDNode(Root, Line, Col, CU); + N->setDebugLoc(DL); AllNodes.push_back(N); return SDValue(N, 0); } diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp index fc45bbda22b..a91dd8e7156 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp @@ -3889,15 +3889,16 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) { DbgStopPointInst &SPI = cast(I); if (DIDescriptor::ValidDebugInfo(SPI.getContext(), OptLevel)) { MachineFunction &MF = DAG.getMachineFunction(); + DICompileUnit CU(cast(SPI.getContext())); + DebugLoc Loc = DebugLoc::get(MF.getOrCreateDebugLocID(CU.getGV(), + SPI.getLine(), SPI.getColumn())); + setCurDebugLoc(Loc); + if (OptLevel == CodeGenOpt::None) - DAG.setRoot(DAG.getDbgStopPoint(getRoot(), + DAG.setRoot(DAG.getDbgStopPoint(Loc, getRoot(), SPI.getLine(), SPI.getColumn(), SPI.getContext())); - DICompileUnit CU(cast(SPI.getContext())); - unsigned idx = MF.getOrCreateDebugLocID(CU.getGV(), - SPI.getLine(), SPI.getColumn()); - setCurDebugLoc(DebugLoc::get(idx)); } return 0; }