[llvm] 7523b89 - [llvm] Remove no-op ptr-to-ptr bitcasts (NFC)
Youngsuk Kim via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 25 17:06:26 PDT 2023
Author: Youngsuk Kim
Date: 2023-10-25T19:01:05-05:00
New Revision: 7523b896434a8d35ff9e8fcbad6e00e0981c954b
URL: https://github.com/llvm/llvm-project/commit/7523b896434a8d35ff9e8fcbad6e00e0981c954b
DIFF: https://github.com/llvm/llvm-project/commit/7523b896434a8d35ff9e8fcbad6e00e0981c954b.diff
LOG: [llvm] Remove no-op ptr-to-ptr bitcasts (NFC)
Opaque pointer cleanup effort. NFC.
Added:
Modified:
llvm/lib/Target/X86/X86WinEHState.cpp
llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86WinEHState.cpp b/llvm/lib/Target/X86/X86WinEHState.cpp
index 694371eba5f78a1..15ad2d60e889f6f 100644
--- a/llvm/lib/Target/X86/X86WinEHState.cpp
+++ b/llvm/lib/Target/X86/X86WinEHState.cpp
@@ -369,9 +369,8 @@ void WinEHStatePass::emitExceptionRegistrationRecord(Function *F) {
}
Value *WinEHStatePass::emitEHLSDA(IRBuilder<> &Builder, Function *F) {
- Value *FI8 = Builder.CreateBitCast(F, Type::getInt8PtrTy(F->getContext()));
return Builder.CreateCall(
- Intrinsic::getDeclaration(TheModule, Intrinsic::x86_seh_lsda), FI8);
+ Intrinsic::getDeclaration(TheModule, Intrinsic::x86_seh_lsda), F);
}
/// Generate a thunk that puts the LSDA of ParentFunc in EAX and then calls
@@ -421,8 +420,7 @@ void WinEHStatePass::linkExceptionRegistration(IRBuilder<> &Builder,
Type *LinkTy = getEHLinkRegistrationType();
// Handler = Handler
- Value *HandlerI8 = Builder.CreateBitCast(Handler, Builder.getInt8PtrTy());
- Builder.CreateStore(HandlerI8, Builder.CreateStructGEP(LinkTy, Link, 1));
+ Builder.CreateStore(Handler, Builder.CreateStructGEP(LinkTy, Link, 1));
// Next = [fs:00]
Constant *FSZero =
Constant::getNullValue(LinkTy->getPointerTo()->getPointerTo(257));
diff --git a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
index e194b96475481d5..56f8d760479d5c2 100644
--- a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
@@ -917,7 +917,6 @@ void HWAddressSanitizer::instrumentMemAccessOutline(Value *Ptr, bool IsWrite,
IRBuilder<> IRB(InsertBefore);
Module *M = IRB.GetInsertBlock()->getParent()->getParent();
- Ptr = IRB.CreateBitCast(Ptr, Int8PtrTy);
IRB.CreateCall(Intrinsic::getDeclaration(
M, UseShortGranules
? Intrinsic::hwasan_check_memaccess_shortgranules
@@ -1752,10 +1751,8 @@ void HWAddressSanitizer::instrumentPersonalityFunctions() {
HwasanPersonalityWrapper,
{ThunkFn->getArg(0), ThunkFn->getArg(1), ThunkFn->getArg(2),
ThunkFn->getArg(3), ThunkFn->getArg(4),
- P.first ? IRB.CreateBitCast(P.first, Int8PtrTy)
- : Constant::getNullValue(Int8PtrTy),
- IRB.CreateBitCast(UnwindGetGR.getCallee(), Int8PtrTy),
- IRB.CreateBitCast(UnwindGetCFA.getCallee(), Int8PtrTy)});
+ P.first ? P.first : Constant::getNullValue(Int8PtrTy),
+ UnwindGetGR.getCallee(), UnwindGetCFA.getCallee()});
WrapperCall->setTailCall();
IRB.CreateRet(WrapperCall);
More information about the llvm-commits
mailing list