Skip to content

Commit 057b1c2

Browse files
authored
[NFC] [HWASan] remove unneeded pointer cast (llvm#150510)
The first argument to a lifetime intrinsic now has to be an alloca
1 parent e520202 commit 057b1c2

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1459,8 +1459,6 @@ void HWAddressSanitizer::instrumentStack(memtag::StackInfo &SInfo,
14591459
size_t Size = memtag::getAllocaSizeInBytes(*AI);
14601460
size_t AlignedSize = alignTo(Size, Mapping.getObjectAlignment());
14611461

1462-
Value *AICast = IRB.CreatePointerCast(AI, PtrTy);
1463-
14641462
auto HandleLifetime = [&](IntrinsicInst *II) {
14651463
// Set the lifetime intrinsic to cover the whole alloca. This reduces the
14661464
// set of assumptions we need to make about the lifetime. Without this we
@@ -1473,14 +1471,13 @@ void HWAddressSanitizer::instrumentStack(memtag::StackInfo &SInfo,
14731471
// one set of start / end in any execution (i.e. the ends are not
14741472
// reachable from each other), so this will not cause any problems.
14751473
II->setArgOperand(0, ConstantInt::get(Int64Ty, AlignedSize));
1476-
II->setArgOperand(1, AICast);
14771474
};
14781475
llvm::for_each(Info.LifetimeStart, HandleLifetime);
14791476
llvm::for_each(Info.LifetimeEnd, HandleLifetime);
14801477

1481-
AI->replaceUsesWithIf(Replacement, [AICast, AILong](const Use &U) {
1478+
AI->replaceUsesWithIf(Replacement, [AILong](const Use &U) {
14821479
auto *User = U.getUser();
1483-
return User != AILong && User != AICast && !isa<LifetimeIntrinsic>(User);
1480+
return User != AILong && !isa<LifetimeIntrinsic>(User);
14841481
});
14851482

14861483
memtag::annotateDebugRecords(Info, retagMask(N));

0 commit comments

Comments
 (0)