memoize the assert results
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23457 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/utils/TableGen/DAGISelEmitter.cpp b/utils/TableGen/DAGISelEmitter.cpp
index bd43909..27c0dfa 100644
--- a/utils/TableGen/DAGISelEmitter.cpp
+++ b/utils/TableGen/DAGISelEmitter.cpp
@@ -1230,8 +1230,11 @@
<< " case ISD::EntryToken: // These leaves remain the same.\n"
<< " return N;\n"
<< " case ISD::AssertSext:\n"
- << " case ISD::AssertZext:\n"
- << " return Select(N.getOperand(0));\n";
+ << " case ISD::AssertZext: {\n"
+ << " SDOperand Tmp0 = Select(N.getOperand(0));\n"
+ << " if (!N.Val->hasOneUse()) CodeGenMap[N] = Tmp0;\n"
+ << " return Tmp0;\n"
+ << " }\n";
// Group the patterns by their top-level opcodes.
std::map<Record*, std::vector<PatternToMatch*>,