@@ -445,7 +445,6 @@ class CodeGenPrepare {
445445 bool optimizeSwitchInst (SwitchInst *SI);
446446 bool optimizeExtractElementInst (Instruction *Inst);
447447 bool dupRetToEnableTailCallOpts (BasicBlock *BB, ModifyDT &ModifiedDT);
448- bool fixupDbgValue (Instruction *I);
449448 bool fixupDbgVariableRecord (DbgVariableRecord &I);
450449 bool fixupDbgVariableRecordsOnInst (Instruction &I);
451450 bool placeDbgValues (Function &F);
@@ -2762,9 +2761,6 @@ bool CodeGenPrepare::optimizeCallInst(CallInst *CI, ModifyDT &ModifiedDT) {
27622761 case Intrinsic::fshl:
27632762 case Intrinsic::fshr:
27642763 return optimizeFunnelShift (II);
2765- case Intrinsic::dbg_assign:
2766- case Intrinsic::dbg_value:
2767- return fixupDbgValue (II);
27682764 case Intrinsic::masked_gather:
27692765 return optimizeGatherScatterInst (II, II->getArgOperand (0 ));
27702766 case Intrinsic::masked_scatter:
@@ -3554,8 +3550,6 @@ class TypePromotionTransaction {
35543550 // / Keep track of the original uses (pair Instruction, Index).
35553551 SmallVector<InstructionAndIdx, 4 > OriginalUses;
35563552 // / Keep track of the debug users.
3557- SmallVector<DbgValueInst *, 1 > DbgValues;
3558- // / And non-instruction debug-users too.
35593553 SmallVector<DbgVariableRecord *, 1 > DbgVariableRecords;
35603554
35613555 // / Keep track of the new value so that we can undo it by replacing
@@ -3577,7 +3571,9 @@ class TypePromotionTransaction {
35773571 }
35783572 // Record the debug uses separately. They are not in the instruction's
35793573 // use list, but they are replaced by RAUW.
3574+ SmallVector<DbgValueInst *> DbgValues;
35803575 findDbgValues (DbgValues, Inst, &DbgVariableRecords);
3576+ assert (DbgValues.empty ());
35813577
35823578 // Now, we can replace the uses.
35833579 Inst->replaceAllUsesWith (New);
@@ -3591,11 +3587,7 @@ class TypePromotionTransaction {
35913587 // RAUW has replaced all original uses with references to the new value,
35923588 // including the debug uses. Since we are undoing the replacements,
35933589 // the original debug uses must also be reinstated to maintain the
3594- // correctness and utility of debug value instructions.
3595- for (auto *DVI : DbgValues)
3596- DVI->replaceVariableLocationOp (New, Inst);
3597- // Similar story with DbgVariableRecords, the non-instruction
3598- // representation of dbg.values.
3590+ // correctness and utility of debug value records.
35993591 for (DbgVariableRecord *DVR : DbgVariableRecords)
36003592 DVR->replaceVariableLocationOp (New, Inst);
36013593 }
@@ -8933,32 +8925,6 @@ bool CodeGenPrepare::optimizeBlock(BasicBlock &BB, ModifyDT &ModifiedDT) {
89338925 return MadeChange;
89348926}
89358927
8936- // Some CGP optimizations may move or alter what's computed in a block. Check
8937- // whether a dbg.value intrinsic could be pointed at a more appropriate operand.
8938- bool CodeGenPrepare::fixupDbgValue (Instruction *I) {
8939- assert (isa<DbgValueInst>(I));
8940- DbgValueInst &DVI = *cast<DbgValueInst>(I);
8941-
8942- // Does this dbg.value refer to a sunk address calculation?
8943- bool AnyChange = false ;
8944- SmallDenseSet<Value *> LocationOps (DVI.location_ops ().begin (),
8945- DVI.location_ops ().end ());
8946- for (Value *Location : LocationOps) {
8947- WeakTrackingVH SunkAddrVH = SunkAddrs[Location];
8948- Value *SunkAddr = SunkAddrVH.pointsToAliveValue () ? SunkAddrVH : nullptr ;
8949- if (SunkAddr) {
8950- // Point dbg.value at locally computed address, which should give the best
8951- // opportunity to be accurately lowered. This update may change the type
8952- // of pointer being referred to; however this makes no difference to
8953- // debugging information, and we can't generate bitcasts that may affect
8954- // codegen.
8955- DVI.replaceVariableLocationOp (Location, SunkAddr);
8956- AnyChange = true ;
8957- }
8958- }
8959- return AnyChange;
8960- }
8961-
89628928bool CodeGenPrepare::fixupDbgVariableRecordsOnInst (Instruction &I) {
89638929 bool AnyChange = false ;
89648930 for (DbgVariableRecord &DVR : filterDbgVars (I.getDbgRecordRange ()))
@@ -8993,14 +8959,6 @@ bool CodeGenPrepare::fixupDbgVariableRecord(DbgVariableRecord &DVR) {
89938959 return AnyChange;
89948960}
89958961
8996- static void DbgInserterHelper (DbgValueInst *DVI, BasicBlock::iterator VI) {
8997- DVI->removeFromParent ();
8998- if (isa<PHINode>(VI))
8999- DVI->insertBefore (VI->getParent ()->getFirstInsertionPt ());
9000- else
9001- DVI->insertAfter (VI);
9002- }
9003-
90048962static void DbgInserterHelper (DbgVariableRecord *DVR, BasicBlock::iterator VI) {
90058963 DVR->removeFromParent ();
90068964 BasicBlock *VIBB = VI->getParent ();
@@ -9065,15 +9023,8 @@ bool CodeGenPrepare::placeDbgValues(Function &F) {
90659023
90669024 for (BasicBlock &BB : F) {
90679025 for (Instruction &Insn : llvm::make_early_inc_range (BB)) {
9068- // Process dbg.value intrinsics.
9069- DbgValueInst *DVI = dyn_cast<DbgValueInst>(&Insn);
9070- if (DVI) {
9071- DbgProcessor (DVI, DVI);
9072- continue ;
9073- }
9074-
9075- // If this isn't a dbg.value, process any attached DbgVariableRecord
9076- // records attached to this instruction.
9026+ // Process any DbgVariableRecord records attached to this
9027+ // instruction.
90779028 for (DbgVariableRecord &DVR : llvm::make_early_inc_range (
90789029 filterDbgVars (Insn.getDbgRecordRange ()))) {
90799030 if (DVR.Type != DbgVariableRecord::LocationType::Value)
0 commit comments