[NFC] [MTE] only do one pass over allocas for stack tagging.

Reviewed By: eugenis

Differential Revision: https://reviews.llvm.org/D119801
This commit is contained in:
Florian Mayer 2022-02-14 18:12:32 -08:00
parent adc402bf3d
commit a650bb58c0
1 changed files with 5 additions and 9 deletions

View File

@ -502,14 +502,6 @@ bool AArch64StackTagging::runOnFunction(Function &Fn) {
if (SInfo.AllocasToInstrument.empty())
return false;
for (auto &I : SInfo.AllocasToInstrument) {
memtag::AllocaInfo &Info = I.second;
assert(Info.AI && isInterestingAlloca(*Info.AI));
auto *PrevAI = Info.AI;
if (memtag::alignAndPadAlloca(Info, kTagGranuleSize))
PrevAI->eraseFromParent();
}
std::unique_ptr<DominatorTree> DeleteDT;
DominatorTree *DT = nullptr;
if (auto *P = getAnalysisIfAvailable<DominatorTreeWrapperPass>())
@ -538,7 +530,11 @@ bool AArch64StackTagging::runOnFunction(Function &Fn) {
int NextTag = 0;
for (auto &I : SInfo.AllocasToInstrument) {
const memtag::AllocaInfo &Info = I.second;
memtag::AllocaInfo &Info = I.second;
assert(Info.AI && isInterestingAlloca(*Info.AI));
auto *PrevAI = Info.AI;
if (memtag::alignAndPadAlloca(Info, kTagGranuleSize))
PrevAI->eraseFromParent();
AllocaInst *AI = Info.AI;
int Tag = NextTag;
NextTag = (NextTag + 1) % 16;