21
21
#include " llvm/Analysis/ScalarEvolution.h"
22
22
#include " llvm/Analysis/ScalarEvolutionExpressions.h"
23
23
#include " llvm/Analysis/StackSafetyAnalysis.h"
24
- #include " llvm/Analysis/ValueTracking.h"
25
24
#include " llvm/CodeGen/LiveRegUnits.h"
26
25
#include " llvm/CodeGen/MachineBasicBlock.h"
27
26
#include " llvm/CodeGen/MachineFunction.h"
@@ -520,7 +519,6 @@ bool AArch64StackTagging::runOnFunction(Function &Fn) {
520
519
for (auto &I : SInfo.AllocasToInstrument ) {
521
520
memtag::AllocaInfo &Info = I.second ;
522
521
assert (Info.AI && SIB.isInterestingAlloca (*Info.AI ));
523
- TrackingVH<Instruction> OldAI = Info.AI ;
524
522
memtag::alignAndPadAlloca (Info, kTagGranuleSize );
525
523
AllocaInst *AI = Info.AI ;
526
524
int Tag = NextTag;
@@ -534,7 +532,8 @@ bool AArch64StackTagging::runOnFunction(Function &Fn) {
534
532
ConstantInt::get (IRB.getInt64Ty (), Tag)});
535
533
if (Info.AI ->hasName ())
536
534
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);
538
537
TagPCall->setOperand (0 , Info.AI );
539
538
540
539
// Calls to functions that may return twice (e.g. setjmp) confuse the
@@ -574,12 +573,6 @@ bool AArch64StackTagging::runOnFunction(Function &Fn) {
574
573
for (auto *II : Info.LifetimeEnd )
575
574
II->eraseFromParent ();
576
575
}
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 );
583
576
}
584
577
585
578
// If we have instrumented at least one alloca, all unrecognized lifetime
0 commit comments