2121#include " llvm/Analysis/ScalarEvolution.h"
2222#include " llvm/Analysis/ScalarEvolutionExpressions.h"
2323#include " llvm/Analysis/StackSafetyAnalysis.h"
24- #include " llvm/Analysis/ValueTracking.h"
2524#include " llvm/CodeGen/LiveRegUnits.h"
2625#include " llvm/CodeGen/MachineBasicBlock.h"
2726#include " llvm/CodeGen/MachineFunction.h"
@@ -520,7 +519,6 @@ bool AArch64StackTagging::runOnFunction(Function &Fn) {
520519 for (auto &I : SInfo.AllocasToInstrument ) {
521520 memtag::AllocaInfo &Info = I.second ;
522521 assert (Info.AI && SIB.isInterestingAlloca (*Info.AI ));
523- TrackingVH<Instruction> OldAI = Info.AI ;
524522 memtag::alignAndPadAlloca (Info, kTagGranuleSize );
525523 AllocaInst *AI = Info.AI ;
526524 int Tag = NextTag;
@@ -534,7 +532,8 @@ bool AArch64StackTagging::runOnFunction(Function &Fn) {
534532 ConstantInt::get (IRB.getInt64Ty (), Tag)});
535533 if (Info.AI ->hasName ())
536534 TagPCall->setName (Info.AI ->getName () + " .tag" );
537- Info.AI ->replaceAllUsesWith (TagPCall);
535+ // Does not replace metadata, so we don't have to handle DPValues.
536+ Info.AI ->replaceNonMetadataUsesWith (TagPCall);
538537 TagPCall->setOperand (0 , Info.AI );
539538
540539 // Calls to functions that may return twice (e.g. setjmp) confuse the
@@ -574,12 +573,6 @@ bool AArch64StackTagging::runOnFunction(Function &Fn) {
574573 for (auto *II : Info.LifetimeEnd )
575574 II->eraseFromParent ();
576575 }
577-
578- // Fixup debug intrinsics to point to the new alloca.
579- for (auto *DVI : Info.DbgVariableIntrinsics )
580- DVI->replaceVariableLocationOp (OldAI, Info.AI );
581- for (auto *DPV : Info.DbgVariableRecords )
582- DPV->replaceVariableLocationOp (OldAI, Info.AI );
583576 }
584577
585578 // If we have instrumented at least one alloca, all unrecognized lifetime
0 commit comments