[NFC] [MemoryTagging] pass AllocaInfo to isStandardLifetime (#180311)
diff --git a/llvm/include/llvm/Transforms/Utils/MemoryTaggingSupport.h b/llvm/include/llvm/Transforms/Utils/MemoryTaggingSupport.h index 53e0f5d..0491287 100644 --- a/llvm/include/llvm/Transforms/Utils/MemoryTaggingSupport.h +++ b/llvm/include/llvm/Transforms/Utils/MemoryTaggingSupport.h
@@ -49,10 +49,8 @@ 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 1a7ed78..3e099e8 100644 --- a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp +++ b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp
@@ -599,8 +599,7 @@ // 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 f7f8284..115053a 100644 --- a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
@@ -1509,8 +1509,7 @@ // 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 c180ecb..e9def70 100644 --- a/llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp +++ b/llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp
@@ -85,17 +85,16 @@ 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) {