Skip to content

Commit 4cc806f

Browse files
committed
[AArch64Arm64ECCallLowering] Drop unnecessary pointer type members (NFC)
With opaque pointers, these are all the same type. Consolidate to just PtrTy.
1 parent a2c1ff1 commit 4cc806f

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

llvm/lib/Target/AArch64/AArch64Arm64ECCallLowering.cpp

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,7 @@ class AArch64Arm64ECCallLowering : public ModulePass {
7878
private:
7979
int cfguard_module_flag = 0;
8080
FunctionType *GuardFnType = nullptr;
81-
PointerType *GuardFnPtrType = nullptr;
8281
FunctionType *DispatchFnType = nullptr;
83-
PointerType *DispatchFnPtrType = nullptr;
8482
Constant *GuardFnCFGlobal = nullptr;
8583
Constant *GuardFnGlobal = nullptr;
8684
Constant *DispatchFnGlobal = nullptr;
@@ -641,7 +639,7 @@ Function *AArch64Arm64ECCallLowering::buildGuestExitThunk(Function *F) {
641639
GuardFn = GuardFnCFGlobal;
642640
else
643641
GuardFn = GuardFnGlobal;
644-
LoadInst *GuardCheckLoad = B.CreateLoad(GuardFnPtrType, GuardFn);
642+
LoadInst *GuardCheckLoad = B.CreateLoad(PtrTy, GuardFn);
645643

646644
// Create new call instruction. The CFGuard check should always be a call,
647645
// even if the original CallBase is an Invoke or CallBr instruction.
@@ -696,7 +694,7 @@ AArch64Arm64ECCallLowering::buildPatchableThunk(GlobalAlias *UnmangledAlias,
696694
IRBuilder<> B(BB);
697695

698696
// Load the global symbol as a pointer to the check function.
699-
LoadInst *DispatchLoad = B.CreateLoad(DispatchFnPtrType, DispatchFnGlobal);
697+
LoadInst *DispatchLoad = B.CreateLoad(PtrTy, DispatchFnGlobal);
700698

701699
// Create new dispatch call instruction.
702700
Function *ExitThunk =
@@ -748,7 +746,7 @@ void AArch64Arm64ECCallLowering::lowerCall(CallBase *CB) {
748746
GuardFn = GuardFnCFGlobal;
749747
else
750748
GuardFn = GuardFnGlobal;
751-
LoadInst *GuardCheckLoad = B.CreateLoad(GuardFnPtrType, GuardFn);
749+
LoadInst *GuardCheckLoad = B.CreateLoad(PtrTy, GuardFn);
752750

753751
// Create new call instruction. The CFGuard check should always be a call,
754752
// even if the original CallBase is an Invoke or CallBr instruction.
@@ -779,15 +777,10 @@ bool AArch64Arm64ECCallLowering::runOnModule(Module &Mod) {
779777
VoidTy = Type::getVoidTy(M->getContext());
780778

781779
GuardFnType = FunctionType::get(PtrTy, {PtrTy, PtrTy}, false);
782-
GuardFnPtrType = PointerType::get(M->getContext(), 0);
783780
DispatchFnType = FunctionType::get(PtrTy, {PtrTy, PtrTy, PtrTy}, false);
784-
DispatchFnPtrType = PointerType::get(M->getContext(), 0);
785-
GuardFnCFGlobal =
786-
M->getOrInsertGlobal("__os_arm64x_check_icall_cfg", GuardFnPtrType);
787-
GuardFnGlobal =
788-
M->getOrInsertGlobal("__os_arm64x_check_icall", GuardFnPtrType);
789-
DispatchFnGlobal =
790-
M->getOrInsertGlobal("__os_arm64x_dispatch_call", DispatchFnPtrType);
781+
GuardFnCFGlobal = M->getOrInsertGlobal("__os_arm64x_check_icall_cfg", PtrTy);
782+
GuardFnGlobal = M->getOrInsertGlobal("__os_arm64x_check_icall", PtrTy);
783+
DispatchFnGlobal = M->getOrInsertGlobal("__os_arm64x_dispatch_call", PtrTy);
791784

792785
// Mangle names of function aliases and add the alias name to
793786
// arm64ec_unmangled_name metadata to ensure a weak anti-dependency symbol is

0 commit comments

Comments
 (0)