convert the new matcher to check intermediate nodes for a single
use and only call IsProfitableToFold/IsLegalToFold on the load
being folded, like the old dagiselemitter does.  This 
substantially simplifies the code and improves opportunities for
sharing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96368 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/utils/TableGen/DAGISelMatcherGen.cpp b/utils/TableGen/DAGISelMatcherGen.cpp
index 07ab472..fac5824 100644
--- a/utils/TableGen/DAGISelMatcherGen.cpp
+++ b/utils/TableGen/DAGISelMatcherGen.cpp
@@ -212,9 +212,7 @@
   const TreePatternNode *Root = Pattern.getSrcPattern();
   if (N != Root &&                             // Not the root of the pattern.
       N->TreeHasProperty(SDNPHasChain, CGP)) { // Has a chain somewhere in tree.
-    
-    AddMatcherNode(new CheckProfitableToFoldMatcherNode());
-    
+
     // If this non-root node produces a chain, we may need to emit a validity
     // check.
     if (OpNo != 0) {
@@ -239,7 +237,7 @@
       }
       
       if (NeedCheck)
-        AddMatcherNode(new CheckLegalToFoldMatcherNode());
+        AddMatcherNode(new CheckFoldableChainNodeMatcherNode());
     }
   }