[llvm] [SelectionDAG] Use Magic Algorithm for Splitting UDIV/UREM by Constant (PR #154968)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 14 22:33:36 PDT 2025


================
@@ -8164,6 +8137,159 @@ bool TargetLowering::expandDIVREMByConstant(SDNode *N,
   return true;
 }
 
+static bool
+expandUDIVREMByConstantViaUMulHiMagic(SDNode *N, const APInt &Divisor,
+                                      SmallVectorImpl<SDValue> &Result,
+                                      EVT HiLoVT, SelectionDAG &DAG, SDValue LL,
+                                      SDValue LH, const TargetLowering &TLI) {
----------------
arsenm wrote:

Move TLI to first argument (or better yet, just make this a TargetLowering member) 

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


More information about the llvm-commits mailing list