[llvm] [AArch64] Support commuted operands in performFlagSettingCombine (PR #162496)

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 8 08:43:48 PDT 2025


================
@@ -26193,9 +26193,21 @@ static SDValue performFlagSettingCombine(SDNode *N,
   }
 
   // Combine identical generic nodes into this node, re-using the result.
-  if (SDNode *Generic = DCI.DAG.getNodeIfExists(
-          GenericOpcode, DCI.DAG.getVTList(VT), {LHS, RHS}))
-    DCI.CombineTo(Generic, SDValue(N, 0));
+  auto CombineWithExistingGeneric = [&](SDValue Op0, SDValue Op1) {
----------------
MacDue wrote:

nit: I found "`With`" a little confusing here (as the generic operation is not being combined). 
```suggestion
  auto CombineToExistingGeneric = [&](SDValue Op0, SDValue Op1) {
```

Also, the comment above would be outdated in the commuted operands case (as the existing generic node is not _identical_, but equivalent) .  

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


More information about the llvm-commits mailing list