Skip to content

Commit 6989859

Browse files
committed
[llvm][HWASan] Replace calls to Type::getPointerTo (NFC)
If `Type::getPointerTo` is called solely to support an unnecessary pointer-cast, remove the call entirely. Otherwise, replace with IRB.getPtrTy(). Clean-up work towards removing method `Type::getPointerTo`.
1 parent 17feb33 commit 6989859

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,10 +1217,8 @@ Value *HWAddressSanitizer::getHwasanThreadSlotPtr(IRBuilder<> &IRB, Type *Ty) {
12171217
// in Bionic's libc/private/bionic_tls.h.
12181218
Function *ThreadPointerFunc =
12191219
Intrinsic::getDeclaration(M, Intrinsic::thread_pointer);
1220-
Value *SlotPtr = IRB.CreatePointerCast(
1221-
IRB.CreateConstGEP1_32(Int8Ty, IRB.CreateCall(ThreadPointerFunc), 0x30),
1222-
Ty->getPointerTo(0));
1223-
return SlotPtr;
1220+
return IRB.CreateConstGEP1_32(Int8Ty, IRB.CreateCall(ThreadPointerFunc),
1221+
0x30);
12241222
}
12251223
if (ThreadPtrGlobal)
12261224
return ThreadPtrGlobal;
@@ -1305,8 +1303,8 @@ void HWAddressSanitizer::emitPrologue(IRBuilder<> &IRB, bool WithFrameRecord) {
13051303

13061304
// Store data to ring buffer.
13071305
Value *FrameRecordInfo = getFrameRecordInfo(IRB);
1308-
Value *RecordPtr = IRB.CreateIntToPtr(ThreadLongMaybeUntagged,
1309-
IntptrTy->getPointerTo(0));
1306+
Value *RecordPtr =
1307+
IRB.CreateIntToPtr(ThreadLongMaybeUntagged, IRB.getPtrTy(0));
13101308
IRB.CreateStore(FrameRecordInfo, RecordPtr);
13111309

13121310
// Update the ring buffer. Top byte of ThreadLong defines the size of the

0 commit comments

Comments
 (0)