@@ -1047,36 +1047,13 @@ DbgInstPtr DIBuilder::insertDbgAssign(Instruction *LinkedInstr, Value *Val,
10471047 LinkedInstr->getMetadata (LLVMContext::MD_DIAssignID));
10481048 assert (Link && " Linked instruction must have DIAssign metadata attached" );
10491049
1050- if (M.IsNewDbgInfoFormat ) {
1051- DbgVariableRecord *DVR = DbgVariableRecord::createDVRAssign (
1052- Val, SrcVar, ValExpr, Link, Addr, AddrExpr, DL);
1053- // Insert after LinkedInstr.
1054- BasicBlock::iterator NextIt = std::next (LinkedInstr->getIterator ());
1055- NextIt.setHeadBit (true );
1056- insertDbgVariableRecord (DVR, NextIt);
1057- return DVR;
1058- }
1059-
1060- LLVMContext &Ctx = LinkedInstr->getContext ();
1061- Module *M = LinkedInstr->getModule ();
1062- if (!AssignFn)
1063- AssignFn = Intrinsic::getOrInsertDeclaration (M, Intrinsic::dbg_assign);
1064-
1065- std::array<Value *, 6 > Args = {
1066- MetadataAsValue::get (Ctx, ValueAsMetadata::get (Val)),
1067- MetadataAsValue::get (Ctx, SrcVar),
1068- MetadataAsValue::get (Ctx, ValExpr),
1069- MetadataAsValue::get (Ctx, Link),
1070- MetadataAsValue::get (Ctx, ValueAsMetadata::get (Addr)),
1071- MetadataAsValue::get (Ctx, AddrExpr),
1072- };
1073-
1074- IRBuilder<> B (Ctx);
1075- B.SetCurrentDebugLocation (DL);
1076-
1077- auto *DVI = cast<DbgAssignIntrinsic>(B.CreateCall (AssignFn, Args));
1078- DVI->insertAfter (LinkedInstr->getIterator ());
1079- return DVI;
1050+ DbgVariableRecord *DVR = DbgVariableRecord::createDVRAssign (
1051+ Val, SrcVar, ValExpr, Link, Addr, AddrExpr, DL);
1052+ // Insert after LinkedInstr.
1053+ BasicBlock::iterator NextIt = std::next (LinkedInstr->getIterator ());
1054+ NextIt.setHeadBit (true );
1055+ insertDbgVariableRecord (DVR, NextIt);
1056+ return DVR;
10801057}
10811058
10821059// / Initialize IRBuilder for inserting dbg.declare and dbg.value intrinsics.
@@ -1101,18 +1078,10 @@ DbgInstPtr DIBuilder::insertDbgValueIntrinsic(llvm::Value *Val,
11011078 DIExpression *Expr,
11021079 const DILocation *DL,
11031080 InsertPosition InsertPt) {
1104- if (M.IsNewDbgInfoFormat ) {
1105- DbgVariableRecord *DVR =
1106- DbgVariableRecord::createDbgVariableRecord (Val, VarInfo, Expr, DL);
1107- insertDbgVariableRecord (DVR, InsertPt);
1108- return DVR;
1109- }
1110-
1111- if (!ValueFn)
1112- ValueFn = Intrinsic::getOrInsertDeclaration (&M, Intrinsic::dbg_value);
1113- auto *DVI = insertDbgIntrinsic (ValueFn, Val, VarInfo, Expr, DL, InsertPt);
1114- cast<CallInst>(DVI)->setTailCall ();
1115- return DVI;
1081+ DbgVariableRecord *DVR =
1082+ DbgVariableRecord::createDbgVariableRecord (Val, VarInfo, Expr, DL);
1083+ insertDbgVariableRecord (DVR, InsertPt);
1084+ return DVR;
11161085}
11171086
11181087DbgInstPtr DIBuilder::insertDeclare (Value *Storage, DILocalVariable *VarInfo,
@@ -1124,25 +1093,10 @@ DbgInstPtr DIBuilder::insertDeclare(Value *Storage, DILocalVariable *VarInfo,
11241093 VarInfo->getScope ()->getSubprogram () &&
11251094 " Expected matching subprograms" );
11261095
1127- if (M.IsNewDbgInfoFormat ) {
1128- DbgVariableRecord *DVR =
1129- DbgVariableRecord::createDVRDeclare (Storage, VarInfo, Expr, DL);
1130- insertDbgVariableRecord (DVR, InsertPt);
1131- return DVR;
1132- }
1133-
1134- if (!DeclareFn)
1135- DeclareFn = getDeclareIntrin (M);
1136-
1137- trackIfUnresolved (VarInfo);
1138- trackIfUnresolved (Expr);
1139- Value *Args[] = {getDbgIntrinsicValueImpl (VMContext, Storage),
1140- MetadataAsValue::get (VMContext, VarInfo),
1141- MetadataAsValue::get (VMContext, Expr)};
1142-
1143- IRBuilder<> B (DL->getContext ());
1144- initIRBuilder (B, DL, InsertPt);
1145- return B.CreateCall (DeclareFn, Args);
1096+ DbgVariableRecord *DVR =
1097+ DbgVariableRecord::createDVRDeclare (Storage, VarInfo, Expr, DL);
1098+ insertDbgVariableRecord (DVR, InsertPt);
1099+ return DVR;
11461100}
11471101
11481102void DIBuilder::insertDbgVariableRecord (DbgVariableRecord *DVR,
@@ -1191,23 +1145,12 @@ DbgInstPtr DIBuilder::insertLabel(DILabel *LabelInfo, const DILocation *DL,
11911145 " Expected matching subprograms" );
11921146
11931147 trackIfUnresolved (LabelInfo);
1194- if (M.IsNewDbgInfoFormat ) {
1195- DbgLabelRecord *DLR = new DbgLabelRecord (LabelInfo, DL);
1196- if (InsertPt.isValid ()) {
1197- auto *BB = InsertPt.getBasicBlock ();
1198- BB->insertDbgRecordBefore (DLR, InsertPt);
1199- }
1200- return DLR;
1148+ DbgLabelRecord *DLR = new DbgLabelRecord (LabelInfo, DL);
1149+ if (InsertPt.isValid ()) {
1150+ auto *BB = InsertPt.getBasicBlock ();
1151+ BB->insertDbgRecordBefore (DLR, InsertPt);
12011152 }
1202-
1203- if (!LabelFn)
1204- LabelFn = Intrinsic::getOrInsertDeclaration (&M, Intrinsic::dbg_label);
1205-
1206- Value *Args[] = {MetadataAsValue::get (VMContext, LabelInfo)};
1207-
1208- IRBuilder<> B (DL->getContext ());
1209- initIRBuilder (B, DL, InsertPt);
1210- return B.CreateCall (LabelFn, Args);
1153+ return DLR;
12111154}
12121155
12131156void DIBuilder::replaceVTableHolder (DICompositeType *&T, DIType *VTableHolder) {
0 commit comments