[llvm] [SelectionDAG] Add space-optimized forms of OPC_EmitNode/OPC_MorphNodeTo (PR #73502)

Wang Pengcheng via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 29 03:43:35 PST 2023


================
@@ -799,19 +799,49 @@ EmitMatcher(const Matcher *N, const unsigned Indent, unsigned CurrentIdx,
     const EmitNodeMatcherCommon *EN = cast<EmitNodeMatcherCommon>(N);
     OS << (isa<EmitNodeMatcher>(EN) ? "OPC_EmitNode" : "OPC_MorphNodeTo");
     bool CompressVTs = EN->getNumVTs() < 3;
-    if (CompressVTs)
+    bool CompressNodeInfo = false;
+    if (CompressVTs) {
       OS << EN->getNumVTs();
+      if (!EN->hasChain() && !EN->hasInGlue() && !EN->hasOutGlue() &&
+          !EN->hasMemRefs() && EN->getNumFixedArityOperands() == -1) {
+        CompressNodeInfo = true;
+        OS << "None";
+      } else if (EN->hasChain() && !EN->hasInGlue() && !EN->hasOutGlue() &&
+                 !EN->hasMemRefs() && EN->getNumFixedArityOperands() == -1) {
+        CompressNodeInfo = true;
+        OS << "Chain";
+      } else if (!EN->hasChain() && EN->hasInGlue() && !EN->hasOutGlue() &&
+                 !EN->hasMemRefs() && EN->getNumFixedArityOperands() == -1) {
+        CompressNodeInfo = true;
+        OS << "GlueInput";
+      } else if (!EN->hasChain() && !EN->hasInGlue() && EN->hasOutGlue() &&
+                 !EN->hasMemRefs() && EN->getNumFixedArityOperands() == -1) {
+        CompressNodeInfo = true;
+        OS << "GlueOutput";
+      } else if (!EN->hasChain() && !EN->hasInGlue() && !EN->hasOutGlue() &&
+                 EN->hasMemRefs() && EN->getNumFixedArityOperands() == -1) {
+        CompressNodeInfo = true;
+        OS << "MemRefs";
----------------
wangpc-pp wrote:

Yeah, I removed all the MemRefs forms and GlueInput/GlueOutput forms of EmitNode. They are not worthy to optimize. Thanks!

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


More information about the llvm-commits mailing list