aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/DIBuilder.cpp
diff options
context:
space:
mode:
authorJeremy Morse <jeremy.morse@sony.com>2025-06-11 16:35:55 +0100
committerJeremy Morse <jeremy.morse@sony.com>2025-06-11 17:35:29 +0100
commit459475020aeff15d0f886ab99c59d66b744d3e17 (patch)
treed16e4a84e71cc75e3183cb6d0a68a86453722d84 /llvm/lib/IR/DIBuilder.cpp
parentfe7bf4b90b1a835418bddd2b2aa63b4977a9f6d2 (diff)
downloadllvm-459475020aeff15d0f886ab99c59d66b744d3e17.zip
llvm-459475020aeff15d0f886ab99c59d66b744d3e17.tar.gz
llvm-459475020aeff15d0f886ab99c59d66b744d3e17.tar.bz2
Reapply 76197ea6f91f after removing an assertion
Specifically this is the assertion in BasicBlock.cpp. Now that we're not examining or setting that flag consistently (because it'll be deleted in about an hour) there's no need to keep this assertion. Original commit title: [DebugInfo][RemoveDIs] Remove some debug intrinsic-only codepaths (#143451)
Diffstat (limited to 'llvm/lib/IR/DIBuilder.cpp')
-rw-r--r--llvm/lib/IR/DIBuilder.cpp97
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) {