[llvm] c6329a3 - [NFC] [MemoryTagging] pass AllocaInfo to isStandardLifetime (#180311)

via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 11 12:47:20 PST 2026


Author: Florian Mayer
Date: 2026-02-11T12:47:16-08:00
New Revision: c6329a3dcc1e08ec73bfb0fd2e8f3b4c6ecf4bef

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

LOG: [NFC] [MemoryTagging] pass AllocaInfo to isStandardLifetime (#180311)

Added: 
    

Modified: 
    llvm/include/llvm/Transforms/Utils/MemoryTaggingSupport.h
    llvm/lib/Target/AArch64/AArch64StackTagging.cpp
    llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
    llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Transforms/Utils/MemoryTaggingSupport.h b/llvm/include/llvm/Transforms/Utils/MemoryTaggingSupport.h
index 53e0f5d1d506c..0491287810941 100644
--- a/llvm/include/llvm/Transforms/Utils/MemoryTaggingSupport.h
+++ b/llvm/include/llvm/Transforms/Utils/MemoryTaggingSupport.h
@@ -49,10 +49,8 @@ bool forAllReachableExits(const DominatorTree &DT, const PostDominatorTree &PDT,
                           const SmallVectorImpl<Instruction *> &RetVec,
                           llvm::function_ref<void(Instruction *)> Callback);
 
-bool isStandardLifetime(const SmallVectorImpl<IntrinsicInst *> &LifetimeStart,
-                        const SmallVectorImpl<IntrinsicInst *> &LifetimeEnd,
-                        const DominatorTree *DT, const LoopInfo *LI,
-                        size_t MaxLifetimes);
+bool isStandardLifetime(const AllocaInfo &AInfo, const DominatorTree *DT,
+                        const LoopInfo *LI, size_t MaxLifetimes);
 
 Instruction *getUntagLocationIfFunctionExit(Instruction &Inst);
 

diff  --git a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp
index 1a7ed7848f057..3e099e8216266 100644
--- a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp
+++ b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp
@@ -599,8 +599,7 @@ bool AArch64StackTagging::runOnFunction(Function &Fn) {
     // statement if return_twice functions are called.
     bool StandardLifetime =
         !SInfo.CallsReturnTwice &&
-        memtag::isStandardLifetime(Info.LifetimeStart, Info.LifetimeEnd, DT, LI,
-                                   ClMaxLifetimes);
+        memtag::isStandardLifetime(Info, DT, LI, ClMaxLifetimes);
     if (StandardLifetime) {
       uint64_t Size = *Info.AI->getAllocationSize(*DL);
       Size = alignTo(Size, kTagGranuleSize);

diff  --git a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
index f7f82842989ef..115053ae34e56 100644
--- a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
@@ -1509,8 +1509,7 @@ void HWAddressSanitizer::instrumentStack(memtag::StackInfo &SInfo,
     // function return. Work around this by always untagging at every return
     // statement if return_twice functions are called.
     if (DetectUseAfterScope && !SInfo.CallsReturnTwice &&
-        memtag::isStandardLifetime(Info.LifetimeStart, Info.LifetimeEnd, &DT,
-                                   &LI, ClMaxLifetimes)) {
+        memtag::isStandardLifetime(Info, &DT, &LI, ClMaxLifetimes)) {
       for (IntrinsicInst *Start : Info.LifetimeStart) {
         IRB.SetInsertPoint(Start->getNextNode());
         tagAlloca(IRB, AI, Tag, Size);

diff  --git a/llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp b/llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp
index c180ecb6a2c61..e9def70d24d9e 100644
--- a/llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp
+++ b/llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp
@@ -85,17 +85,16 @@ bool forAllReachableExits(const DominatorTree &DT, const PostDominatorTree &PDT,
   return !UncoveredRets;
 }
 
-bool isStandardLifetime(const SmallVectorImpl<IntrinsicInst *> &LifetimeStart,
-                        const SmallVectorImpl<IntrinsicInst *> &LifetimeEnd,
-                        const DominatorTree *DT, const LoopInfo *LI,
-                        size_t MaxLifetimes) {
+bool isStandardLifetime(const AllocaInfo &AInfo, const DominatorTree *DT,
+                        const LoopInfo *LI, size_t MaxLifetimes) {
   // An alloca that has exactly one start and end in every possible execution.
   // If it has multiple ends, they have to be unreachable from each other, so
   // at most one of them is actually used for each execution of the function.
-  return LifetimeStart.size() > 0 &&
-         (LifetimeEnd.size() == 1 ||
-          (LifetimeEnd.size() > 0 &&
-           !maybeReachableFromEachOther(LifetimeEnd, DT, LI, MaxLifetimes)));
+  return AInfo.LifetimeStart.size() > 0 &&
+         (AInfo.LifetimeEnd.size() == 1 ||
+          (AInfo.LifetimeEnd.size() > 0 &&
+           !maybeReachableFromEachOther(AInfo.LifetimeEnd, DT, LI,
+                                        MaxLifetimes)));
 }
 
 Instruction *getUntagLocationIfFunctionExit(Instruction &Inst) {


        


More information about the llvm-commits mailing list