[llvm] [X86] Optimized ADD + ADC to ADC (PR #173543)

Sebastian Buchwald via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 6 23:47:58 PST 2026


================
@@ -57898,7 +57898,10 @@ static SDValue combineFunnelShift(SDNode *N, SelectionDAG &DAG,
 static bool needCarryOrOverflowFlag(SDValue Flags) {
   assert(Flags.getValueType() == MVT::i32 && "Unexpected VT!");
 
-  for (const SDNode *User : Flags->users()) {
+  for (const SDUse &Use : Flags->uses()) {
+    if (Use != Flags)
+      continue;
----------------
UniQP wrote:

The loop iterates over all users of the `SDNode`, which has two `SDValue`s – one for the sum and one for the flags. We are only interested in users of the flags, so we skip other users. Previously, this method was only called for `CMP` nodes, where it didn't make a difference because the flags are the only `SDValue`.

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


More information about the llvm-commits mailing list