aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorFlorian Mayer <fmayer@google.com>2026-02-11 12:47:16 -0800
committerGitHub <noreply@github.com>2026-02-11 12:47:16 -0800
commitc6329a3dcc1e08ec73bfb0fd2e8f3b4c6ecf4bef (patch)
treea572327f1b21e75e88233486f1683c63a9e4e1ae /llvm/lib/Transforms
parentd518d495315621bc751927069dbf609866f98b90 (diff)
downloadllvm-c6329a3dcc1e08ec73bfb0fd2e8f3b4c6ecf4bef.tar.gz
llvm-c6329a3dcc1e08ec73bfb0fd2e8f3b4c6ecf4bef.tar.bz2
llvm-c6329a3dcc1e08ec73bfb0fd2e8f3b4c6ecf4bef.zip
[NFC] [MemoryTagging] pass AllocaInfo to isStandardLifetime (#180311)
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp3
-rw-r--r--llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp15
2 files changed, 8 insertions, 10 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
index f7f82842989e..115053ae34e5 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 c180ecb6a2c6..e9def70d24d9 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) {