Skip to content

Commit 7523b89

Browse files
committed
[llvm] Remove no-op ptr-to-ptr bitcasts (NFC)
Opaque pointer cleanup effort. NFC.
1 parent b82c629 commit 7523b89

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

llvm/lib/Target/X86/X86WinEHState.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -369,9 +369,8 @@ void WinEHStatePass::emitExceptionRegistrationRecord(Function *F) {
369369
}
370370

371371
Value *WinEHStatePass::emitEHLSDA(IRBuilder<> &Builder, Function *F) {
372-
Value *FI8 = Builder.CreateBitCast(F, Type::getInt8PtrTy(F->getContext()));
373372
return Builder.CreateCall(
374-
Intrinsic::getDeclaration(TheModule, Intrinsic::x86_seh_lsda), FI8);
373+
Intrinsic::getDeclaration(TheModule, Intrinsic::x86_seh_lsda), F);
375374
}
376375

377376
/// Generate a thunk that puts the LSDA of ParentFunc in EAX and then calls
@@ -421,8 +420,7 @@ void WinEHStatePass::linkExceptionRegistration(IRBuilder<> &Builder,
421420

422421
Type *LinkTy = getEHLinkRegistrationType();
423422
// Handler = Handler
424-
Value *HandlerI8 = Builder.CreateBitCast(Handler, Builder.getInt8PtrTy());
425-
Builder.CreateStore(HandlerI8, Builder.CreateStructGEP(LinkTy, Link, 1));
423+
Builder.CreateStore(Handler, Builder.CreateStructGEP(LinkTy, Link, 1));
426424
// Next = [fs:00]
427425
Constant *FSZero =
428426
Constant::getNullValue(LinkTy->getPointerTo()->getPointerTo(257));

llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,6 @@ void HWAddressSanitizer::instrumentMemAccessOutline(Value *Ptr, bool IsWrite,
917917

918918
IRBuilder<> IRB(InsertBefore);
919919
Module *M = IRB.GetInsertBlock()->getParent()->getParent();
920-
Ptr = IRB.CreateBitCast(Ptr, Int8PtrTy);
921920
IRB.CreateCall(Intrinsic::getDeclaration(
922921
M, UseShortGranules
923922
? Intrinsic::hwasan_check_memaccess_shortgranules
@@ -1752,10 +1751,8 @@ void HWAddressSanitizer::instrumentPersonalityFunctions() {
17521751
HwasanPersonalityWrapper,
17531752
{ThunkFn->getArg(0), ThunkFn->getArg(1), ThunkFn->getArg(2),
17541753
ThunkFn->getArg(3), ThunkFn->getArg(4),
1755-
P.first ? IRB.CreateBitCast(P.first, Int8PtrTy)
1756-
: Constant::getNullValue(Int8PtrTy),
1757-
IRB.CreateBitCast(UnwindGetGR.getCallee(), Int8PtrTy),
1758-
IRB.CreateBitCast(UnwindGetCFA.getCallee(), Int8PtrTy)});
1754+
P.first ? P.first : Constant::getNullValue(Int8PtrTy),
1755+
UnwindGetGR.getCallee(), UnwindGetCFA.getCallee()});
17591756
WrapperCall->setTailCall();
17601757
IRB.CreateRet(WrapperCall);
17611758

0 commit comments

Comments
 (0)