[llvm] [SDAG][X86] Merge MMOs when reusing morphed node (PR #206700)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 1 00:11:23 PDT 2026


================
@@ -4461,7 +4461,34 @@ void SelectionDAGISel::SelectCodeCommon(SDNode *NodeToMatch,
           }
         }
 
-        CurDAG->setNodeMemRefs(Res, FilteredMemRefs);
+        if (Res->memoperands_empty()) {
+          // If the node is new, just copy the MMOs.
+          CurDAG->setNodeMemRefs(Res, FilteredMemRefs);
----------------
nikic wrote:

We're transferring MMOs from MemSDNodes, which always have at least one MMO. I don't think the "no MMO means any location" thing is applicable at the SDAG level, it's only relevant at the MI level?

Do you have an example that would trigger the situation you are concerned about?

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


More information about the llvm-commits mailing list