diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 0cd91ad5720..f6fb089789c 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -1114,7 +1114,7 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) { case Intrinsic::dbg_stoppoint: { MachineDebugInfo *DebugInfo = DAG.getMachineDebugInfo(); DbgStopPointInst &SPI = cast(I); - if (DebugInfo && DebugInfo->Verify(SPI.getContext())) { + if (DebugInfo && SPI.getContext() && DebugInfo->Verify(SPI.getContext())) { std::vector Ops; Ops.push_back(getRoot()); @@ -1136,7 +1136,7 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) { case Intrinsic::dbg_region_start: { MachineDebugInfo *DebugInfo = DAG.getMachineDebugInfo(); DbgRegionStartInst &RSI = cast(I); - if (DebugInfo && DebugInfo->Verify(RSI.getContext())) { + if (DebugInfo && RSI.getContext() && DebugInfo->Verify(RSI.getContext())) { std::vector Ops; unsigned LabelID = DebugInfo->RecordRegionStart(RSI.getContext()); @@ -1152,7 +1152,7 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) { case Intrinsic::dbg_region_end: { MachineDebugInfo *DebugInfo = DAG.getMachineDebugInfo(); DbgRegionEndInst &REI = cast(I); - if (DebugInfo && DebugInfo->Verify(REI.getContext())) { + if (DebugInfo && REI.getContext() && DebugInfo->Verify(REI.getContext())) { std::vector Ops; unsigned LabelID = DebugInfo->RecordRegionEnd(REI.getContext()); @@ -1168,7 +1168,8 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) { case Intrinsic::dbg_func_start: { MachineDebugInfo *DebugInfo = DAG.getMachineDebugInfo(); DbgFuncStartInst &FSI = cast(I); - if (DebugInfo && DebugInfo->Verify(FSI.getSubprogram())) { + if (DebugInfo && FSI.getSubprogram() && + DebugInfo->Verify(FSI.getSubprogram())) { std::vector Ops; unsigned LabelID = DebugInfo->RecordRegionStart(FSI.getSubprogram()); diff --git a/lib/VMCore/IntrinsicInst.cpp b/lib/VMCore/IntrinsicInst.cpp index 8bdb944373a..2c2c5a96edf 100644 --- a/lib/VMCore/IntrinsicInst.cpp +++ b/lib/VMCore/IntrinsicInst.cpp @@ -45,13 +45,13 @@ static Value *CastOperand(Value *C) { Value *DbgInfoIntrinsic::StripCast(Value *C) { if (Value *CO = CastOperand(C)) { - return StripCast(CO); + C = StripCast(CO); } else if (GlobalVariable *GV = dyn_cast(C)) { if (GV->hasInitializer()) if (Value *CO = CastOperand(GV->getInitializer())) - return StripCast(CO); + C = StripCast(CO); } - return C; + return dyn_cast(C); } //===----------------------------------------------------------------------===//