From fbcf23c3c12449c264f1448a2eee524be0b799f7 Mon Sep 17 00:00:00 2001 From: Jim Laskey Date: Sun, 26 Mar 2006 22:46:27 +0000 Subject: [PATCH] Bullet proof against undefined args produced by upgrading ols-style debug info. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27155 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 9 +++++---- lib/VMCore/IntrinsicInst.cpp | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) 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); } //===----------------------------------------------------------------------===//