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

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


Author: Florian Mayer
Date: 2022-02-15T13:09:24-08:00
New Revision: a650bb58c096d4e505c69e8ad5d7aea7d4289ef8

URL: https://github.com/llvm/llvm-project/commit/a650bb58c096d4e505c69e8ad5d7aea7d4289ef8
DIFF: https://github.com/llvm/llvm-project/commit/a650bb58c096d4e505c69e8ad5d7aea7d4289ef8.diff

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

Reviewed By: eugenis

Differential Revision: https://reviews.llvm.org/D119801

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp
index 11b34b1bf90ad..22383432d1a8a 100644
--- a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp
+++ b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp
@@ -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;


        


More information about the llvm-commits mailing list