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

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 10 05:21:26 PDT 2025


================
@@ -11848,25 +11848,37 @@ SDValue SelectionDAG::getTargetInsertSubreg(int SRIdx, const SDLoc &DL, EVT VT,
 /// getNodeIfExists - Get the specified node if it's already available, or
 /// else return NULL.
 SDNode *SelectionDAG::getNodeIfExists(unsigned Opcode, SDVTList VTList,
-                                      ArrayRef<SDValue> Ops) {
+                                      ArrayRef<SDValue> Ops,
+                                      bool AllowCommute) {
   SDNodeFlags Flags;
   if (Inserter)
     Flags = Inserter->getFlags();
-  return getNodeIfExists(Opcode, VTList, Ops, Flags);
+  return getNodeIfExists(Opcode, VTList, Ops, Flags, AllowCommute);
 }
 
 SDNode *SelectionDAG::getNodeIfExists(unsigned Opcode, SDVTList VTList,
                                       ArrayRef<SDValue> Ops,
-                                      const SDNodeFlags Flags) {
-  if (VTList.VTs[VTList.NumVTs - 1] != MVT::Glue) {
-    FoldingSetNodeID ID;
-    AddNodeIDNode(ID, Opcode, VTList, Ops);
-    void *IP = nullptr;
-    if (SDNode *E = FindNodeOrInsertPos(ID, SDLoc(), IP)) {
-      E->intersectFlagsWith(Flags);
-      return E;
+                                      const SDNodeFlags Flags,
+                                      bool AllowCommute) {
+  auto Lookup = [&](ArrayRef<SDValue> LookupOps) -> SDNode * {
+    if (VTList.VTs[VTList.NumVTs - 1] != MVT::Glue) {
----------------
paulwalker-arm wrote:

Perhaps worth pulling the `MVT::Glue` check out of the lambda.

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


More information about the llvm-commits mailing list