[llvm] aac603c - ARM: Avoid repeating hardcoded windows division libcall names (#143834)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 12 05:20:48 PDT 2025


Author: Matt Arsenault
Date: 2025-06-12T21:20:45+09:00
New Revision: aac603c47800bf2e167b53ddfd3bb10be292bc53

URL: https://github.com/llvm/llvm-project/commit/aac603c47800bf2e167b53ddfd3bb10be292bc53
DIFF: https://github.com/llvm/llvm-project/commit/aac603c47800bf2e167b53ddfd3bb10be292bc53.diff

LOG: ARM: Avoid repeating hardcoded windows division libcall names (#143834)

This is properly set in the runtime libcall info, so query
the name.

Added: 
    

Modified: 
    llvm/lib/Target/ARM/ARMISelLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp
index f17eb72bb2e26..5b3664c4e961f 100644
--- a/llvm/lib/Target/ARM/ARMISelLowering.cpp
+++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp
@@ -9998,13 +9998,13 @@ SDValue ARMTargetLowering::LowerWindowsDIVLibCall(SDValue Op, SelectionDAG &DAG,
   SDLoc dl(Op);
 
   const auto &DL = DAG.getDataLayout();
-
-  const char *Name = nullptr;
+  RTLIB::Libcall LC;
   if (Signed)
-    Name = (VT == MVT::i32) ? "__rt_sdiv" : "__rt_sdiv64";
+    LC = VT == MVT::i32 ? RTLIB::SDIVREM_I32 : RTLIB::SDIVREM_I64;
   else
-    Name = (VT == MVT::i32) ? "__rt_udiv" : "__rt_udiv64";
+    LC = VT == MVT::i32 ? RTLIB::UDIVREM_I32 : RTLIB::UDIVREM_I64;
 
+  const char *Name = getLibcallName(LC);
   SDValue ES = DAG.getExternalSymbol(Name, getPointerTy(DL));
 
   ARMTargetLowering::ArgListTy Args;


        


More information about the llvm-commits mailing list