diff options
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/Local.cpp | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index 2c63283..6d7c710 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -1693,9 +1693,7 @@ static void insertDbgValueOrDbgVariableRecord(DIBuilder &Builder, Value *DV, const DebugLoc &NewLoc, BasicBlock::iterator Instr) { if (!UseNewDbgInfoFormat) { - auto DbgVal = Builder.insertDbgValueIntrinsic(DV, DIVar, DIExpr, NewLoc, - (Instruction *)nullptr); - cast<Instruction *>(DbgVal)->insertBefore(Instr); + Builder.insertDbgValueIntrinsic(DV, DIVar, DIExpr, NewLoc, Instr); } else { // RemoveDIs: if we're using the new debug-info format, allocate a // DbgVariableRecord directly instead of a dbg.value intrinsic. @@ -1708,19 +1706,10 @@ static void insertDbgValueOrDbgVariableRecord(DIBuilder &Builder, Value *DV, static void insertDbgValueOrDbgVariableRecordAfter( DIBuilder &Builder, Value *DV, DILocalVariable *DIVar, DIExpression *DIExpr, - const DebugLoc &NewLoc, BasicBlock::iterator Instr) { - if (!UseNewDbgInfoFormat) { - auto DbgVal = Builder.insertDbgValueIntrinsic(DV, DIVar, DIExpr, NewLoc, - (Instruction *)nullptr); - cast<Instruction *>(DbgVal)->insertAfter(Instr); - } else { - // RemoveDIs: if we're using the new debug-info format, allocate a - // DbgVariableRecord directly instead of a dbg.value intrinsic. - ValueAsMetadata *DVAM = ValueAsMetadata::get(DV); - DbgVariableRecord *DV = - new DbgVariableRecord(DVAM, DIVar, DIExpr, NewLoc.get()); - Instr->getParent()->insertDbgRecordAfter(DV, &*Instr); - } + const DebugLoc &NewLoc, Instruction *Instr) { + BasicBlock::iterator NextIt = std::next(Instr->getIterator()); + NextIt.setHeadBit(true); + insertDbgValueOrDbgVariableRecord(Builder, DV, DIVar, DIExpr, NewLoc, NextIt); } /// Inserts a llvm.dbg.value intrinsic before a store to an alloca'd value @@ -1812,7 +1801,7 @@ void llvm::ConvertDebugDeclareToDebugValue(DbgVariableIntrinsic *DII, // preferable to keep tracking both the loaded value and the original // address in case the alloca can not be elided. insertDbgValueOrDbgVariableRecordAfter(Builder, LI, DIVar, DIExpr, NewLoc, - LI->getIterator()); + LI); } void llvm::ConvertDebugDeclareToDebugValue(DbgVariableRecord *DVR, |