File tree Expand file tree Collapse file tree 3 files changed +10
-6
lines changed
include/llvm/Transforms/Utils Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -76,12 +76,12 @@ struct AllocaInfo {
7676 AllocaInst *AI;
7777 SmallVector<IntrinsicInst *, 2 > LifetimeStart;
7878 SmallVector<IntrinsicInst *, 2 > LifetimeEnd;
79+ SmallVector<DbgVariableIntrinsic *, 2 > DbgVariableIntrinsics;
7980};
8081
8182struct StackInfo {
8283 MapVector<AllocaInst *, AllocaInfo> AllocasToInstrument;
8384 SmallVector<Instruction *, 4 > UnrecognizedLifetimes;
84- DenseMap<AllocaInst *, std::vector<DbgVariableIntrinsic *>> AllocaDbgMap;
8585 SmallVector<Instruction *, 8 > RetVec;
8686 bool CallsReturnTwice = false ;
8787};
Original file line number Diff line number Diff line change @@ -1341,7 +1341,7 @@ bool HWAddressSanitizer::instrumentStack(
13411341 AI->replaceUsesWithIf (Replacement,
13421342 [AILong](Use &U) { return U.getUser () != AILong; });
13431343
1344- for (auto *DDI : SInfo. AllocaDbgMap . lookup (AI) ) {
1344+ for (auto *DDI : Info. DbgVariableIntrinsics ) {
13451345 // Prepend "tag_offset, N" to the dwarf expression.
13461346 // Tag offset logically applies to the alloca pointer, and it makes sense
13471347 // to put it at the beginning of the expression.
Original file line number Diff line number Diff line change @@ -87,10 +87,14 @@ void StackInfoBuilder::visit(Instruction &Inst) {
8787 }
8888 if (auto *DVI = dyn_cast<DbgVariableIntrinsic>(&Inst)) {
8989 for (Value *V : DVI->location_ops ()) {
90- if (auto *Alloca = dyn_cast_or_null<AllocaInst>(V))
91- if (!Info.AllocaDbgMap .count (Alloca) ||
92- Info.AllocaDbgMap [Alloca].back () != DVI)
93- Info.AllocaDbgMap [Alloca].push_back (DVI);
90+ if (auto *AI = dyn_cast_or_null<AllocaInst>(V)) {
91+ if (!IsInterestingAlloca (*AI))
92+ continue ;
93+ AllocaInfo &AInfo = Info.AllocasToInstrument [AI];
94+ auto &DVIVec = AInfo.DbgVariableIntrinsics ;
95+ if (DVIVec.empty () || DVIVec.back () != DVI)
96+ DVIVec.push_back (DVI);
97+ }
9498 }
9599 }
96100 Instruction *ExitUntag = getUntagLocationIfFunctionExit (Inst);
You can’t perform that action at this time.
0 commit comments