diff options
author | Jeremy Morse <jeremy.morse@sony.com> | 2025-06-11 14:43:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-11 14:43:15 +0100 |
commit | c71a2e688828ab3ede4fb54168a674ff68396f61 (patch) | |
tree | b62f008e717b4233949489263ac349723d39dfdc /llvm/lib/IR/DIBuilder.cpp | |
parent | 6b0cb762af97579ca8ff5eea9be896169a1752b7 (diff) | |
download | llvm-c71a2e688828ab3ede4fb54168a674ff68396f61.zip llvm-c71a2e688828ab3ede4fb54168a674ff68396f61.tar.gz llvm-c71a2e688828ab3ede4fb54168a674ff68396f61.tar.bz2 |
[DebugInfo][RemoveDIs] Remove some debug intrinsic-only codepaths (#143451)
These are opportunistic deletions as more places that make use of the
IsNewDbgInfoFormat flag are removed. It should (TM)(R) all be dead code
now that `IsNewDbgInfoFormat` should be true everywhere.
FastISel: we don't need to do debug-aware instruction counting any more,
because there are no debug instructions,
Autoupgrade: you can no-longer avoid autoupgrading of intrinsics to
records
DIBuilder: Delete the code for creating debug intrinsics (!)
LoopUtils: No need to handle debug instructions, they don't exist
Diffstat (limited to 'llvm/lib/IR/DIBuilder.cpp')
-rw-r--r-- | llvm/lib/IR/DIBuilder.cpp | 97 |
1 files changed, 20 insertions, 77 deletions
diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp index 5e5ff22..1484c54 100644 --- a/llvm/lib/IR/DIBuilder.cpp +++ b/llvm/lib/IR/DIBuilder.cpp @@ -1047,36 +1047,13 @@ DbgInstPtr DIBuilder::insertDbgAssign(Instruction *LinkedInstr, Value *Val, LinkedInstr->getMetadata(LLVMContext::MD_DIAssignID)); assert(Link && "Linked instruction must have DIAssign metadata attached"); - if (M.IsNewDbgInfoFormat) { - DbgVariableRecord *DVR = DbgVariableRecord::createDVRAssign( - Val, SrcVar, ValExpr, Link, Addr, AddrExpr, DL); - // Insert after LinkedInstr. - BasicBlock::iterator NextIt = std::next(LinkedInstr->getIterator()); - NextIt.setHeadBit(true); - insertDbgVariableRecord(DVR, NextIt); - return DVR; - } - - LLVMContext &Ctx = LinkedInstr->getContext(); - Module *M = LinkedInstr->getModule(); - if (!AssignFn) - AssignFn = Intrinsic::getOrInsertDeclaration(M, Intrinsic::dbg_assign); - - std::array<Value *, 6> Args = { - MetadataAsValue::get(Ctx, ValueAsMetadata::get(Val)), - MetadataAsValue::get(Ctx, SrcVar), - MetadataAsValue::get(Ctx, ValExpr), - MetadataAsValue::get(Ctx, Link), - MetadataAsValue::get(Ctx, ValueAsMetadata::get(Addr)), - MetadataAsValue::get(Ctx, AddrExpr), - }; - - IRBuilder<> B(Ctx); - B.SetCurrentDebugLocation(DL); - - auto *DVI = cast<DbgAssignIntrinsic>(B.CreateCall(AssignFn, Args)); - DVI->insertAfter(LinkedInstr->getIterator()); - return DVI; + DbgVariableRecord *DVR = DbgVariableRecord::createDVRAssign( + Val, SrcVar, ValExpr, Link, Addr, AddrExpr, DL); + // Insert after LinkedInstr. + BasicBlock::iterator NextIt = std::next(LinkedInstr->getIterator()); + NextIt.setHeadBit(true); + insertDbgVariableRecord(DVR, NextIt); + return DVR; } /// Initialize IRBuilder for inserting dbg.declare and dbg.value intrinsics. @@ -1101,18 +1078,10 @@ DbgInstPtr DIBuilder::insertDbgValueIntrinsic(llvm::Value *Val, DIExpression *Expr, const DILocation *DL, InsertPosition InsertPt) { - if (M.IsNewDbgInfoFormat) { - DbgVariableRecord *DVR = - DbgVariableRecord::createDbgVariableRecord(Val, VarInfo, Expr, DL); - insertDbgVariableRecord(DVR, InsertPt); - return DVR; - } - - if (!ValueFn) - ValueFn = Intrinsic::getOrInsertDeclaration(&M, Intrinsic::dbg_value); - auto *DVI = insertDbgIntrinsic(ValueFn, Val, VarInfo, Expr, DL, InsertPt); - cast<CallInst>(DVI)->setTailCall(); - return DVI; + DbgVariableRecord *DVR = + DbgVariableRecord::createDbgVariableRecord(Val, VarInfo, Expr, DL); + insertDbgVariableRecord(DVR, InsertPt); + return DVR; } DbgInstPtr DIBuilder::insertDeclare(Value *Storage, DILocalVariable *VarInfo, @@ -1124,25 +1093,10 @@ DbgInstPtr DIBuilder::insertDeclare(Value *Storage, DILocalVariable *VarInfo, VarInfo->getScope()->getSubprogram() && "Expected matching subprograms"); - if (M.IsNewDbgInfoFormat) { - DbgVariableRecord *DVR = - DbgVariableRecord::createDVRDeclare(Storage, VarInfo, Expr, DL); - insertDbgVariableRecord(DVR, InsertPt); - return DVR; - } - - if (!DeclareFn) - DeclareFn = getDeclareIntrin(M); - - trackIfUnresolved(VarInfo); - trackIfUnresolved(Expr); - Value *Args[] = {getDbgIntrinsicValueImpl(VMContext, Storage), - MetadataAsValue::get(VMContext, VarInfo), - MetadataAsValue::get(VMContext, Expr)}; - - IRBuilder<> B(DL->getContext()); - initIRBuilder(B, DL, InsertPt); - return B.CreateCall(DeclareFn, Args); + DbgVariableRecord *DVR = + DbgVariableRecord::createDVRDeclare(Storage, VarInfo, Expr, DL); + insertDbgVariableRecord(DVR, InsertPt); + return DVR; } void DIBuilder::insertDbgVariableRecord(DbgVariableRecord *DVR, @@ -1191,23 +1145,12 @@ DbgInstPtr DIBuilder::insertLabel(DILabel *LabelInfo, const DILocation *DL, "Expected matching subprograms"); trackIfUnresolved(LabelInfo); - if (M.IsNewDbgInfoFormat) { - DbgLabelRecord *DLR = new DbgLabelRecord(LabelInfo, DL); - if (InsertPt.isValid()) { - auto *BB = InsertPt.getBasicBlock(); - BB->insertDbgRecordBefore(DLR, InsertPt); - } - return DLR; + DbgLabelRecord *DLR = new DbgLabelRecord(LabelInfo, DL); + if (InsertPt.isValid()) { + auto *BB = InsertPt.getBasicBlock(); + BB->insertDbgRecordBefore(DLR, InsertPt); } - - if (!LabelFn) - LabelFn = Intrinsic::getOrInsertDeclaration(&M, Intrinsic::dbg_label); - - Value *Args[] = {MetadataAsValue::get(VMContext, LabelInfo)}; - - IRBuilder<> B(DL->getContext()); - initIRBuilder(B, DL, InsertPt); - return B.CreateCall(LabelFn, Args); + return DLR; } void DIBuilder::replaceVTableHolder(DICompositeType *&T, DIType *VTableHolder) { |