[llvm] [SelectionDAG] Fix condition used for unsigned subtraction overflow (PR #170896)

via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 8 02:16:20 PST 2025


================
@@ -11466,7 +11466,9 @@ void TargetLowering::expandUADDSUBO(
                      DAG.getConstant(0, dl, Node->getValueType(0)), ISD::SETNE);
   } else {
     ISD::CondCode CC = IsAdd ? ISD::SETULT : ISD::SETUGT;
-    SetCC = DAG.getSetCC(dl, SetCCType, Result, LHS, CC);
+    SDValue CompareLHS = IsAdd ? Result : LHS;
+    SDValue CompareRHS = IsAdd ? LHS : RHS;
----------------
aabhinavg1 wrote:

The suggestion looks good .
I will update it and re-run the tests. Thanks!

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


More information about the llvm-commits mailing list