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

Florian Mayer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 15 13:09:41 PST 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa650bb58c096: [NFC] [MTE] only do one pass over allocas for stack tagging. (authored by fmayer).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119801/new/

https://reviews.llvm.org/D119801

Files:
  llvm/lib/Target/AArch64/AArch64StackTagging.cpp


Index: llvm/lib/Target/AArch64/AArch64StackTagging.cpp
===================================================================
--- llvm/lib/Target/AArch64/AArch64StackTagging.cpp
+++ llvm/lib/Target/AArch64/AArch64StackTagging.cpp
@@ -502,14 +502,6 @@
   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 @@
 
   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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119801.409030.patch
Type: text/x-patch
Size: 1176 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220215/59e5f9a3/attachment.bin>


More information about the llvm-commits mailing list