[llvm] [DAGCombiner][LegalizeTypes] Fuse i128 sdiv+srem / udiv+urem into single __divmodti4 / __udivmodti4 call (PR #187908)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 31 01:03:06 PDT 2026


================
@@ -5061,7 +5061,12 @@ SDValue DAGCombiner::useDivRem(SDNode *Node) {
   if (VT.isVector() || !VT.isInteger())
     return SDValue();
 
-  if (!TLI.isTypeLegal(VT) && !TLI.isOperationCustom(DivRemOpc, VT))
+  // For non-legal types, only allow the DIVREM node to form when a fused
+  // libcall is available.  ExpandIntRes_DIVREM currently only handles i128;
+  // extending to other widths requires generalizing it to select the libcall
+  // by VT.
+  if (!(TLI.isTypeLegal(VT) || TLI.isOperationCustom(DivRemOpc, VT) ||
----------------
arsenm wrote:

Another one here 

https://github.com/llvm/llvm-project/pull/187908


More information about the llvm-commits mailing list