[llvm] [SelectionDAG][X86] Fold `sub(x, mul(divrem(x,y)[0], y))` to `divrem(x, y)[1]` (PR #136565)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 22 02:23:25 PDT 2025


================
@@ -4094,6 +4150,9 @@ SDValue DAGCombiner::visitSUB(SDNode *N) {
   if (SDValue V = foldSubToUSubSat(VT, N, DL))
     return V;
 
+  if (SDValue V = foldRemainderIdiom(N, DAG))
----------------
RKSimon wrote:

(trivial) Pass DL as an arg instead of recreating it inside foldRemainderIdiom

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


More information about the llvm-commits mailing list