Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1460,8 +1460,6 @@ bool HWAddressSanitizer::instrumentStack(memtag::StackInfo &SInfo,
size_t Size = memtag::getAllocaSizeInBytes(*AI);
size_t AlignedSize = alignTo(Size, Mapping.getObjectAlignment());

Value *AICast = IRB.CreatePointerCast(AI, PtrTy);

auto HandleLifetime = [&](IntrinsicInst *II) {
// Set the lifetime intrinsic to cover the whole alloca. This reduces the
// set of assumptions we need to make about the lifetime. Without this we
Expand All @@ -1474,14 +1472,13 @@ bool HWAddressSanitizer::instrumentStack(memtag::StackInfo &SInfo,
// one set of start / end in any execution (i.e. the ends are not
// reachable from each other), so this will not cause any problems.
II->setArgOperand(0, ConstantInt::get(Int64Ty, AlignedSize));
II->setArgOperand(1, AICast);
};
llvm::for_each(Info.LifetimeStart, HandleLifetime);
llvm::for_each(Info.LifetimeEnd, HandleLifetime);

AI->replaceUsesWithIf(Replacement, [AICast, AILong](const Use &U) {
AI->replaceUsesWithIf(Replacement, [AILong](const Use &U) {
auto *User = U.getUser();
return User != AILong && User != AICast && !isa<LifetimeIntrinsic>(User);
return User != AILong && !isa<LifetimeIntrinsic>(User);
});

memtag::annotateDebugRecords(Info, retagMask(N));
Expand Down