summaryrefslogtreecommitdiffstats
path: root/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-06-30 03:02:03 +0000
committerChris Lattner <sabre@nondot.org>2008-06-30 03:02:03 +0000
commit2e253b426ffaf8058ef94f50db2a1d2905e6b4c6 (patch)
tree226724dae0a5d21f35637d0af4afa5be1138040d /llvm/utils/TableGen/CodeGenDAGPatterns.cpp
parent9d3740ed1cfa614125b4b8f7399787f879a18608 (diff)
downloadbcm5719-llvm-2e253b426ffaf8058ef94f50db2a1d2905e6b4c6.tar.gz
bcm5719-llvm-2e253b426ffaf8058ef94f50db2a1d2905e6b4c6.zip
check in anton's patch to make inlining happen in a determinstic order
and fix the bug that it uncovers: inlining a pattern fragment could bring in other pattern fragments if the inlinee hadn't already been inlined. llvm-svn: 52888
Diffstat (limited to 'llvm/utils/TableGen/CodeGenDAGPatterns.cpp')
-rw-r--r--llvm/utils/TableGen/CodeGenDAGPatterns.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
index 2a7fd0bbfa2..1948c904adc 100644
--- a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
+++ b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
@@ -679,7 +679,10 @@ TreePatternNode *TreePatternNode::InlinePatternFragments(TreePattern &TP) {
// Get a new copy of this fragment to stitch into here.
//delete this; // FIXME: implement refcounting!
- return FragTree;
+
+ // The fragment we inlined could have recursive inlining that is needed. See
+ // if there are any pattern fragments in it and inline them as needed.
+ return FragTree->InlinePatternFragments(TP);
}
/// getImplicitType - Check to see if the specified record has an implicit
@@ -1383,9 +1386,8 @@ void CodeGenDAGPatterns::ParsePatternFragments() {
// Now that we've parsed all of the tree fragments, do a closure on them so
// that there are not references to PatFrags left inside of them.
- for (std::map<Record*, TreePattern*>::iterator I = PatternFragments.begin(),
- E = PatternFragments.end(); I != E; ++I) {
- TreePattern *ThePat = I->second;
+ for (unsigned i = 0, e = Fragments.size(); i != e; ++i) {
+ TreePattern *ThePat = PatternFragments[Fragments[i]];
ThePat->InlinePatternFragments();
// Infer as many types as possible. Don't worry about it if we don't infer
OpenPOWER on IntegriCloud