[llvm] 754d6af - [NFC] Improve code reuse.
Florian Mayer via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 21 10:51:04 PST 2022
Author: Florian Mayer
Date: 2022-01-21T10:50:54-08:00
New Revision: 754d6af7c35983612241b9a077722f4471bbd683
URL: https://github.com/llvm/llvm-project/commit/754d6af7c35983612241b9a077722f4471bbd683
DIFF: https://github.com/llvm/llvm-project/commit/754d6af7c35983612241b9a077722f4471bbd683.diff
LOG: [NFC] Improve code reuse.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D116711
Added:
Modified:
llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
index 8d3bc1383e96d..fb10a99d13382 100644
--- a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
@@ -1403,16 +1403,16 @@ bool HWAddressSanitizer::instrumentStack(
size_t Size = getAllocaSizeInBytes(*AI);
size_t AlignedSize = alignTo(Size, Mapping.getObjectAlignment());
+ auto TagEnd = [&](Instruction *Node) {
+ IRB.SetInsertPoint(Node);
+ Value *UARTag = getUARTag(IRB, StackTag);
+ tagAlloca(IRB, AI, UARTag, AlignedSize);
+ };
bool StandardLifetime =
UnrecognizedLifetimes.empty() && isStandardLifetime(Info, GetDT());
if (DetectUseAfterScope && StandardLifetime) {
IntrinsicInst *Start = Info.LifetimeStart[0];
IRB.SetInsertPoint(Start->getNextNode());
- auto TagEnd = [&](Instruction *Node) {
- IRB.SetInsertPoint(Node);
- Value *UARTag = getUARTag(IRB, StackTag);
- tagAlloca(IRB, AI, UARTag, AlignedSize);
- };
tagAlloca(IRB, AI, Tag, Size);
if (!forAllReachableExits(GetDT(), GetPDT(), Start, Info.LifetimeEnd,
RetVec, TagEnd)) {
@@ -1421,11 +1421,8 @@ bool HWAddressSanitizer::instrumentStack(
}
} else {
tagAlloca(IRB, AI, Tag, Size);
- for (auto *RI : RetVec) {
- IRB.SetInsertPoint(RI);
- Value *UARTag = getUARTag(IRB, StackTag);
- tagAlloca(IRB, AI, UARTag, AlignedSize);
- }
+ for (auto *RI : RetVec)
+ TagEnd(RI);
if (!StandardLifetime) {
for (auto &II : Info.LifetimeStart)
II->eraseFromParent();
More information about the llvm-commits
mailing list