Skip to content

ARM: Remove idiv runtime call aliases #152098

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 5, 2025

Conversation

arsenm
Copy link
Contributor

@arsenm arsenm commented Aug 5, 2025

Really only the i32 variants exist. We don't need synthetic
aliases for illegal types which will be promoted.

Copy link
Contributor Author

arsenm commented Aug 5, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@llvmbot
Copy link
Member

llvmbot commented Aug 5, 2025

@llvm/pr-subscribers-llvm-ir

@llvm/pr-subscribers-backend-arm

Author: Matt Arsenault (arsenm)

Changes

Really only the i32 variants exist. We don't need synthetic
aliases for illegal types which will be promoted.


Full diff: https://github.com/llvm/llvm-project/pull/152098.diff

2 Files Affected:

  • (modified) llvm/include/llvm/IR/RuntimeLibcalls.td (+2-6)
  • (modified) llvm/lib/IR/RuntimeLibcalls.cpp (+2-4)
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.td b/llvm/include/llvm/IR/RuntimeLibcalls.td
index 384b7f29b9073..8c53f12cf09ac 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.td
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.td
@@ -1399,13 +1399,9 @@ def __aeabi_lasr : RuntimeLibcallImpl<SRA_I64>; // CallingConv::ARM_AAPCS
 
 // Integer division functions
 // RTABI chapter 4.3.1
-def __aeabi_idiv__i8 : RuntimeLibcallImpl<SDIV_I8, "__aeabi_idiv">; // CallingConv::ARM_AAPCS
-def __aeabi_idiv__i16 : RuntimeLibcallImpl<SDIV_I16, "__aeabi_idiv">; // CallingConv::ARM_AAPCS
-def __aeabi_idiv__i32 : RuntimeLibcallImpl<SDIV_I32, "__aeabi_idiv">; // CallingConv::ARM_AAPCS
+def __aeabi_idiv : RuntimeLibcallImpl<SDIV_I32, "__aeabi_idiv">; // CallingConv::ARM_AAPCS
 def __aeabi_ldivmod : RuntimeLibcallImpl<SDIVREM_I64>; //  CallingConv::ARM_AAPCS
-def __aeabi_uidiv__i8 : RuntimeLibcallImpl<UDIV_I8, "__aeabi_uidiv">; // CallingConv::ARM_AAPCS
-def __aeabi_uidiv__i16 : RuntimeLibcallImpl<UDIV_I16, "__aeabi_uidiv">; // CallingConv::ARM_AAPCS
-def __aeabi_uidiv__i32 : RuntimeLibcallImpl<UDIV_I32, "__aeabi_uidiv">; // CallingConv::ARM_AAPCS
+def __aeabi_uidiv : RuntimeLibcallImpl<UDIV_I32, "__aeabi_uidiv">; // CallingConv::ARM_AAPCS
 def __aeabi_uldivmod : RuntimeLibcallImpl<UDIVREM_I64>; // CallingConv::ARM_AAPCS
 
 def __aeabi_idivmod : RuntimeLibcallImpl<SDIVREM_I32>; //  CallingConv::ARM_AAPCS
diff --git a/llvm/lib/IR/RuntimeLibcalls.cpp b/llvm/lib/IR/RuntimeLibcalls.cpp
index b6e2cac5f7b04..a8e6c7938cf54 100644
--- a/llvm/lib/IR/RuntimeLibcalls.cpp
+++ b/llvm/lib/IR/RuntimeLibcalls.cpp
@@ -47,11 +47,9 @@ static void setARMLibcallNames(RuntimeLibcallsInfo &Info, const Triple &TT,
       RTLIB::__aeabi_ui2f,        RTLIB::__aeabi_l2f,
       RTLIB::__aeabi_ul2f,        RTLIB::__aeabi_lmul,
       RTLIB::__aeabi_llsl,        RTLIB::__aeabi_llsr,
-      RTLIB::__aeabi_lasr,        RTLIB::__aeabi_idiv__i8,
-      RTLIB::__aeabi_idiv__i16,   RTLIB::__aeabi_idiv__i32,
+      RTLIB::__aeabi_lasr,        RTLIB::__aeabi_idiv,
       RTLIB::__aeabi_idivmod,     RTLIB::__aeabi_uidivmod,
-      RTLIB::__aeabi_ldivmod,     RTLIB::__aeabi_uidiv__i8,
-      RTLIB::__aeabi_uidiv__i16,  RTLIB::__aeabi_uidiv__i32,
+      RTLIB::__aeabi_ldivmod,     RTLIB::__aeabi_uidiv,
       RTLIB::__aeabi_uldivmod,    RTLIB::__aeabi_f2h,
       RTLIB::__aeabi_d2h,         RTLIB::__aeabi_h2f,
       RTLIB::__aeabi_memcpy,      RTLIB::__aeabi_memmove,

@arsenm arsenm requested a review from RKSimon August 5, 2025 08:02
@arsenm arsenm marked this pull request as ready for review August 5, 2025 08:02
@llvmbot llvmbot added the llvm:ir label Aug 5, 2025
Really only the i32 variants exist. We don't need synthetic
aliases for illegal types which will be promoted.
@arsenm arsenm force-pushed the users/arsenm/arm/remove-idiv-libcall-aliases branch from a294d5d to fea1584 Compare August 5, 2025 08:03
Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, assuming there is test coverage for the sub-word divisions somewhere...

@arsenm arsenm merged commit 1392edc into main Aug 5, 2025
9 checks passed
@arsenm arsenm deleted the users/arsenm/arm/remove-idiv-libcall-aliases branch August 5, 2025 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants