From: Jessica Paquette Date: Fri, 28 Jul 2017 05:59:30 +0000 (+0000) Subject: [MachineOutliner] NFC: Comment tidying X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8ebdca40c8e561b5c2cebb553f2bec0b7fdc7201;p=llvm [MachineOutliner] NFC: Comment tidying The comment on describing the suffix tree had some pruning stuff that was out of date in it. Also fixed some typos. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309365 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/MachineOutliner.cpp b/lib/CodeGen/MachineOutliner.cpp index 8df57a27e8a..a0cf8eab2af 100644 --- a/lib/CodeGen/MachineOutliner.cpp +++ b/lib/CodeGen/MachineOutliner.cpp @@ -187,8 +187,7 @@ struct SuffixTreeNode { /// \brief For internal nodes, a pointer to the internal node representing /// the same sequence with the first character chopped off. /// - /// This has two major purposes in the suffix tree. The first is as a - /// shortcut in Ukkonen's construction algorithm. One of the things that + /// This acts as a shortcut in Ukkonen's algorithm. One of the things that /// Ukkonen's algorithm does to achieve linear-time construction is /// keep track of which node the next insert should be at. This makes each /// insert O(1), and there are a total of O(N) inserts. The suffix link @@ -203,27 +202,6 @@ struct SuffixTreeNode { /// move to the next insertion point in O(1) time. If we don't, then we'd /// have to query from the root, which takes O(N) time. This would make the /// construction algorithm O(N^2) rather than O(N). - /// - /// The suffix link is also used during the tree pruning process to let us - /// quickly throw out a bunch of potential overlaps. Say we have a sequence - /// S we want to outline. Then each of its suffixes contribute to at least - /// one overlapping case. Therefore, we can follow the suffix links - /// starting at the node associated with S to the root and "delete" those - /// nodes, save for the root. For each candidate, this removes - /// O(|candidate|) overlaps from the search space. We don't actually - /// completely invalidate these nodes though; doing that is far too - /// aggressive. Consider the following pathological string: - /// - /// 1 2 3 1 2 3 2 3 2 3 2 3 2 3 2 3 2 3 - /// - /// If we, for the sake of example, outlined 1 2 3, then we would throw - /// out all instances of 2 3. This isn't desirable. To get around this, - /// when we visit a link node, we decrement its occurrence count by the - /// number of sequences we outlined in the current step. In the pathological - /// example, the 2 3 node would have an occurrence count of 8, while the - /// 1 2 3 node would have an occurrence count of 2. Thus, the 2 3 node - /// would survive to the next round allowing us to outline the extra - /// instances of 2 3. SuffixTreeNode *Link = nullptr; /// The parent of this node. Every node except for the root has a parent.