diff options
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Utils/Local.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index 9b28f837d70..5c46111822b 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -1147,13 +1147,15 @@ void llvm::ConvertDebugDeclareToDebugValue(DbgDeclareInst *DDI, if (PhiHasDebugValue(DIVar, DIExpr, APN)) return; - auto BB = APN->getParent(); + BasicBlock *BB = APN->getParent(); auto InsertionPt = BB->getFirstInsertionPt(); - if (InsertionPt != BB->end()) { - Instruction *DbgValue = Builder.insertDbgValueIntrinsic( - APN, 0, DIVar, DIExpr, DDI->getDebugLoc(), (Instruction *)nullptr); - DbgValue->insertBefore(&*InsertionPt); - } + + // The block may be a catchswitch block, which does not have a valid + // insertion point. + // FIXME: Insert dbg.value markers in the successors when appropriate. + if (InsertionPt != BB->end()) + Builder.insertDbgValueIntrinsic(APN, 0, DIVar, DIExpr, DDI->getDebugLoc(), + &*InsertionPt); } /// Determine whether this alloca is either a VLA or an array. |

