[llvm] r348439 - [MachineOutliner][NFC] Move yet another std::vector out of a loop

Jessica Paquette via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 5 16:26:21 PST 2018


Author: paquette
Date: Wed Dec  5 16:26:21 2018
New Revision: 348439

URL: http://llvm.org/viewvc/llvm-project?rev=348439&view=rev
Log:
[MachineOutliner][NFC] Move yet another std::vector out of a loop

Once again, following the wisdom of the LLVM Programmer's Manual.

I think that's enough refactoring for today. :)

Modified:
    llvm/trunk/lib/CodeGen/MachineOutliner.cpp

Modified: llvm/trunk/lib/CodeGen/MachineOutliner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineOutliner.cpp?rev=348439&r1=348438&r2=348439&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineOutliner.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineOutliner.cpp Wed Dec  5 16:26:21 2018
@@ -519,18 +519,19 @@ public:
       RS = RepeatedSubstring();
       N = nullptr;
 
+      // Each leaf node represents a repeat of a string.
+      std::vector<SuffixTreeNode *> LeafChildren;
+
       // Continue visiting nodes until we find one which repeats more than once.
       while (!ToVisit.empty()) {
         SuffixTreeNode *Curr = ToVisit.back();
         ToVisit.pop_back();
+        LeafChildren.clear();
 
         // Keep track of the length of the string associated with the node. If
         // it's too short, we'll quit.
         unsigned Length = Curr->ConcatLen;
 
-        // Each leaf node represents a repeat of a string.
-        std::vector<SuffixTreeNode *> LeafChildren;
-
         // Iterate over each child, saving internal nodes for visiting, and
         // leaf nodes in LeafChildren. Internal nodes represent individual
         // strings, which may repeat.




More information about the llvm-commits mailing list